亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? resources.java

?? 本套系統(tǒng)采用了業(yè)界當(dāng)前最為流行的beanAction組件
?? JAVA
字號:
/*
 *  Copyright 2004 Clinton Begin
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.ibatis.common.resources;

import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.Charset;
import java.util.Properties;

/**
 * A class to simplify access to resources through the classloader.
 */
public class Resources extends Object {

  private static ClassLoader defaultClassLoader;
  
  /**
   * Charset to use when calling getResourceAsReader.
   * null means use the system default.
   */
  private static Charset charset;

  private Resources() {
  }

  /**
   * Returns the default classloader (may be null).
   *
   * @return The default classloader
   */
  public static ClassLoader getDefaultClassLoader() {
    return defaultClassLoader;
  }

  /**
   * Sets the default classloader
   *
   * @param defaultClassLoader - the new default ClassLoader
   */
  public static void setDefaultClassLoader(ClassLoader defaultClassLoader) {
    Resources.defaultClassLoader = defaultClassLoader;
  }

  /**
   * Returns the URL of the resource on the classpath
   *
   * @param resource The resource to find
   * @return The resource
   * @throws IOException If the resource cannot be found or read
   */
  public static URL getResourceURL(String resource) throws IOException {
    return getResourceURL(getClassLoader(), resource);
  }

  /**
   * Returns the URL of the resource on the classpath
   *
   * @param loader   The classloader used to load the resource
   * @param resource The resource to find
   * @return The resource
   * @throws IOException If the resource cannot be found or read
   */
  public static URL getResourceURL(ClassLoader loader, String resource) throws IOException {
    URL url = null;
    if (loader != null) url = loader.getResource(resource);
    if (url == null) url = ClassLoader.getSystemResource(resource);
    if (url == null) throw new IOException("Could not find resource " + resource);
    return url;
  }

  /**
   * Returns a resource on the classpath as a Stream object
   *
   * @param resource The resource to find
   * @return The resource
   * @throws IOException If the resource cannot be found or read
   */
  public static InputStream getResourceAsStream(String resource) throws IOException {
    return getResourceAsStream(getClassLoader(), resource);
  }

  /**
   * Returns a resource on the classpath as a Stream object
   *
   * @param loader   The classloader used to load the resource
   * @param resource The resource to find
   * @return The resource
   * @throws IOException If the resource cannot be found or read
   */
  public static InputStream getResourceAsStream(ClassLoader loader, String resource) throws IOException {
    InputStream in = null;
    if (loader != null) in = loader.getResourceAsStream(resource);
    if (in == null) in = ClassLoader.getSystemResourceAsStream(resource);
    if (in == null) throw new IOException("Could not find resource " + resource);
    return in;
  }

  /**
   * Returns a resource on the classpath as a Properties object
   *
   * @param resource The resource to find
   * @return The resource
   * @throws IOException If the resource cannot be found or read
   */
  public static Properties getResourceAsProperties(String resource)
      throws IOException {
    Properties props = new Properties();
    InputStream in = null;
    String propfile = resource;
    in = getResourceAsStream(propfile);
    props.load(in);
    in.close();
    return props;
  }

  /**
   * Returns a resource on the classpath as a Properties object
   *
   * @param loader   The classloader used to load the resource
   * @param resource The resource to find
   * @return The resource
   * @throws IOException If the resource cannot be found or read
   */
  public static Properties getResourceAsProperties(ClassLoader loader, String resource)
      throws IOException {
    Properties props = new Properties();
    InputStream in = null;
    String propfile = resource;
    in = getResourceAsStream(loader, propfile);
    props.load(in);
    in.close();
    return props;
  }

  /**
   * Returns a resource on the classpath as a Reader object
   *
   * @param resource The resource to find
   * @return The resource
   * @throws IOException If the resource cannot be found or read
   */
  public static Reader getResourceAsReader(String resource) throws IOException {
    Reader reader;
    if (charset == null) {
      reader = new InputStreamReader(getResourceAsStream(resource));
    } else {
      reader = new InputStreamReader(getResourceAsStream(resource), charset);
    }
    
    return reader;
  }

  /**
   * Returns a resource on the classpath as a Reader object
   *
   * @param loader   The classloader used to load the resource
   * @param resource The resource to find
   * @return The resource
   * @throws IOException If the resource cannot be found or read
   */
  public static Reader getResourceAsReader(ClassLoader loader, String resource) throws IOException {
    Reader reader;
    if (charset == null) {
      reader = new InputStreamReader(getResourceAsStream(loader, resource));
    } else {
      reader = new InputStreamReader(getResourceAsStream(loader, resource), charset);
    }
    
    return reader;
  }

  /**
   * Returns a resource on the classpath as a File object
   *
   * @param resource The resource to find
   * @return The resource
   * @throws IOException If the resource cannot be found or read
   */
  public static File getResourceAsFile(String resource) throws IOException {
    return new File(getResourceURL(resource).getFile());
  }

  /**
   * Returns a resource on the classpath as a File object
   *
   * @param loader   - the classloader used to load the resource
   * @param resource - the resource to find
   * @return The resource
   * @throws IOException If the resource cannot be found or read
   */
  public static File getResourceAsFile(ClassLoader loader, String resource) throws IOException {
    return new File(getResourceURL(loader, resource).getFile());
  }

  /**
   * Gets a URL as an input stream
   *
   * @param urlString - the URL to get
   * @return An input stream with the data from the URL
   * @throws IOException If the resource cannot be found or read
   */
  public static InputStream getUrlAsStream(String urlString) throws IOException {
    URL url = new URL(urlString);
    URLConnection conn = url.openConnection();
    return conn.getInputStream();
  }

  /**
   * Gets a URL as a Reader
   *
   * @param urlString - the URL to get
   * @return A Reader with the data from the URL
   * @throws IOException If the resource cannot be found or read
   */
  public static Reader getUrlAsReader(String urlString) throws IOException {
    return new InputStreamReader(getUrlAsStream(urlString));
  }

  /**
   * Gets a URL as a Properties object
   *
   * @param urlString - the URL to get
   * @return A Properties object with the data from the URL
   * @throws IOException If the resource cannot be found or read
   */
  public static Properties getUrlAsProperties(String urlString) throws IOException {
    Properties props = new Properties();
    InputStream in = null;
    String propfile = urlString;
    in = getUrlAsStream(propfile);
    props.load(in);
    in.close();
    return props;
  }

  /**
   * Loads a class
   *
   * @param className - the class to load
   * @return The loaded class
   * @throws ClassNotFoundException If the class cannot be found (duh!)
   */
  public static Class classForName(String className) throws ClassNotFoundException {
    Class clazz = null;
    try {
      clazz = getClassLoader().loadClass(className);
    } catch (Exception e) {
      // Ignore.  Failsafe below.
    }
    if (clazz == null) {
      clazz = Class.forName(className);
    }
    return clazz;
  }

  /**
   * Creates an instance of a class
   *
   * @param className - the class to create
   * @return An instance of the class
   * @throws ClassNotFoundException If the class cannot be found (duh!)
   * @throws InstantiationException If the class cannot be instantiaed
   * @throws IllegalAccessException If the class is not public, or other access problems arise
   */
  public static Object instantiate(String className)
      throws ClassNotFoundException, InstantiationException, IllegalAccessException {
    return instantiate(classForName(className));
  }

  /**
   * Creates an instance of a class
   *
   * @param clazz - the class to create
   * @return An instance of the class
   * @throws InstantiationException If the class cannot be instantiaed
   * @throws IllegalAccessException If the class is not public, or other access problems arise
   */
  public static Object instantiate(Class clazz)
      throws InstantiationException, IllegalAccessException {
    return clazz.newInstance();
  }

  private static ClassLoader getClassLoader() {
    if (defaultClassLoader != null) {
      return defaultClassLoader;
    } else {
      return Thread.currentThread().getContextClassLoader();
    }
  }

  public static Charset getCharset() {
    return charset;
  }

  /**
   * Use this method to set the Charset to be used when
   * calling the getResourceAsReader methods.  This will
   * allow iBATIS to function properly when the system default
   * encoding doesn't deal well with unicode (IBATIS-340, IBATIS-349)
   * 
   * @param charset
   */
  public static void setCharset(Charset charset) {
    Resources.charset = charset;
  }

}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区二区在线播放相泽| 亚洲曰韩产成在线| 成人久久久精品乱码一区二区三区 | 欧美精品乱码久久久久久| 99久久国产综合精品女不卡| 国产精品69毛片高清亚洲| 久久国产成人午夜av影院| 麻豆91在线看| 蜜桃一区二区三区在线观看| 久久精品国产久精国产爱| 国产综合色产在线精品| 粉嫩绯色av一区二区在线观看| 99久久夜色精品国产网站| a在线欧美一区| 91电影在线观看| 欧美日韩激情在线| 91精品国产欧美一区二区成人| 日韩欧美www| 欧美激情在线看| 亚洲综合免费观看高清完整版| 亚洲va天堂va国产va久| 久久电影网电视剧免费观看| 日本韩国一区二区三区视频| 欧美妇女性影城| 久久精品无码一区二区三区| 日本一区二区三区国色天香 | 九九在线精品视频| 国产电影精品久久禁18| 日本韩国精品在线| 欧美不卡123| 亚洲综合一二区| 国产成人亚洲综合a∨婷婷| 91豆麻精品91久久久久久| 欧美变态tickling挠脚心| 一区在线播放视频| 久草热8精品视频在线观看| 91一区二区在线观看| 日韩欧美在线影院| 亚洲人午夜精品天堂一二香蕉| 美脚の诱脚舐め脚责91| 色综合激情五月| 久久夜色精品一区| 午夜电影久久久| 99热在这里有精品免费| 26uuu国产日韩综合| 亚洲永久免费av| 不卡欧美aaaaa| 欧美成人精品高清在线播放| 亚洲私人黄色宅男| 成人综合在线网站| 精品理论电影在线| 亚洲成av人影院在线观看网| 91视频在线观看| 亚洲国产精品二十页| 精品在线免费视频| 日韩精品一区二区三区中文不卡 | 欧美精品一区在线观看| 亚洲国产成人av网| 91同城在线观看| 中文字幕精品在线不卡| 国产一区二区三区精品视频| 欧美一区中文字幕| 亚洲成av人片一区二区梦乃| 日本高清不卡在线观看| 亚洲欧美影音先锋| 97久久精品人人澡人人爽| 国产精品免费aⅴ片在线观看| 国产美女主播视频一区| 精品国产乱码久久久久久牛牛| 青椒成人免费视频| 欧美二区三区91| 青青草国产成人99久久| 欧美一级黄色大片| 精品中文字幕一区二区| 欧美精品一区男女天堂| 国产一区二区福利视频| 国产无遮挡一区二区三区毛片日本| 国产一区二区三区视频在线播放| 久久亚洲精品小早川怜子| 国产精品一区专区| 国产精品久久久久天堂| 不卡欧美aaaaa| 一区二区三区在线影院| 欧美日韩一区二区电影| 欧美bbbbb| 国产欧美一区二区三区在线看蜜臀| 国产99久久久国产精品潘金网站| 欧美精品一区二区三区蜜桃视频| 国产一区二区三区黄视频| 中文字幕欧美激情一区| 91麻豆视频网站| 五月综合激情日本mⅴ| 欧美一区二区高清| 成人黄色电影在线 | 尤物av一区二区| 欧美人xxxx| 日韩高清欧美激情| 26uuu亚洲婷婷狠狠天堂| 国产又黄又大久久| 亚洲欧美日韩中文播放| 911精品产国品一二三产区| 激情伊人五月天久久综合| 中文字幕一区二区不卡| 欧美妇女性影城| 国产成人aaa| 午夜精品久久久久久不卡8050| 精品日韩99亚洲| 亚洲视频每日更新| 欧美日韩另类一区| 国产精品88888| 亚洲一区二区不卡免费| 久久一区二区三区四区| 色94色欧美sute亚洲线路一ni | 1000部国产精品成人观看| 欧美日韩一级二级三级| 成人一区二区视频| 日本美女一区二区三区| 亚洲素人一区二区| 久久综合久久综合久久| 欧美日韩一区二区在线观看视频 | 日韩美女在线视频| 色天使色偷偷av一区二区| 激情六月婷婷久久| 亚洲图片欧美色图| 国产精品理论片| 精品1区2区在线观看| 欧美艳星brazzers| 91在线播放网址| 国产精品一色哟哟哟| 青草国产精品久久久久久| 亚洲综合精品自拍| 亚洲欧美国产高清| 中文字幕av资源一区| 久久中文娱乐网| 亚洲国产成人私人影院tom| 欧美一区二区网站| 欧美日韩综合一区| 一本色道久久综合亚洲精品按摩| 国产 欧美在线| 国产精品一区二区在线播放| 美国三级日本三级久久99| 日韩和欧美一区二区三区| 亚洲国产日产av| 亚洲网友自拍偷拍| 亚洲电影在线播放| 亚洲国产欧美在线人成| 亚洲成人自拍偷拍| 亚洲制服欧美中文字幕中文字幕| 亚洲欧美激情一区二区| 亚洲精品国产无套在线观| 亚洲人成在线播放网站岛国| 亚洲色图制服诱惑 | 欧美综合色免费| 色婷婷av一区二区三区软件| 91视视频在线观看入口直接观看www| 大胆亚洲人体视频| 91在线丨porny丨国产| 91老师片黄在线观看| 91国偷自产一区二区三区观看| 91成人免费在线视频| 91麻豆精品国产91久久久久 | 亚洲成人资源在线| 欧美a级一区二区| 免费成人结看片| 国产精品综合一区二区| 欧美日韩一区精品| 制服丝袜日韩国产| 精品少妇一区二区三区日产乱码| 精品国产露脸精彩对白| 国产精品午夜在线| 亚洲国产中文字幕在线视频综合| 爽好久久久欧美精品| 国产成人aaaa| 欧美日本在线看| 久久综合色婷婷| 亚洲欧美色图小说| 免费成人av在线播放| 岛国精品在线观看| 欧美三区在线观看| 国产三级三级三级精品8ⅰ区| 亚洲日本va午夜在线影院| 午夜电影网一区| 国产成人aaaa| 欧美一区二区三区四区视频 | 91一区二区在线| 欧美一激情一区二区三区| 国产日本欧洲亚洲| 亚洲国产成人精品视频| 国产一区二区三区在线观看精品| 色婷婷综合五月| 26uuu欧美| 亚洲国产精品麻豆| 国产91丝袜在线观看| 91精品国产色综合久久久蜜香臀| 国产欧美一区二区三区网站 | 国产人成亚洲第一网站在线播放| 亚洲一二三专区| 不卡av电影在线播放| 欧美刺激脚交jootjob| 亚洲一线二线三线视频|