posts - 5,  comments - 1,  trackbacks - 0

          1。使用java.util.Properties類(lèi)的load()方法示例:InputStreamin=lnewBufferedInputStream(newFileInputStream(name));Propertiesp=newProperties();p.load(in);


          2。使用java.util.ResourceBundle類(lèi)的getBundle()方法示例:ResourceBundlerb=ResourceBundle.getBundle(name,Locale.getDefault());


          3。使用java.util.PropertyResourceBundle類(lèi)的構(gòu)造函數(shù)示例:InputStreamin=newBufferedInputStream(newFileInputStream(name));ResourceBundlerb=newPropertyResourceBundle(in);


          4。使用class變量的getResourceAsStream()方法示例:InputStreamin=JProperties.class.getResourceAsStream(name);Propertiesp=newProperties();p.load(in);


          5。使用class.getClassLoader()所得到的java.lang.ClassLoader的getResourceAsStream()方法示例:InputStreamin=JProperties.class.getClassLoader().getResourceAsStream(name);Propertiesp=newProperties();p.load(in);


          6。使用java.lang.ClassLoader類(lèi)的getSystemResourceAsStream()靜態(tài)方法示例:InputStreamin=ClassLoader.getSystemResourceAsStream(name);Propertiesp=newProperties();p.load(in);


          補(bǔ)充
          Servlet中可以使用javax.servlet.ServletContext的getResourceAsStream()方法示例:InputStreamin=context.getResourceAsStream(path);Propertiesp=newProperties();p.load(in);

          posted on 2007-03-29 14:09 阿健 閱讀(212) 評(píng)論(0)  編輯  收藏

          只有注冊(cè)用戶(hù)登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          <2007年3月>
          25262728123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

          常用鏈接

          留言簿(2)

          隨筆分類(lèi)

          隨筆檔案

          相冊(cè)

          BLOG

          Web Site

          搜索

          •  

          最新評(píng)論

          • 1.?re: 《大腕》IT版
          • 頂一下! 不錯(cuò)! 框架越多越好, 您要是只整了個(gè) Struts, 您都不要意思跟人說(shuō)您是做 Java 的!
          • --BeanSoft

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 丹凤县| 芜湖市| 浦北县| 玉田县| 共和县| 胶南市| 房产| 呼伦贝尔市| 米脂县| 乌什县| 迁西县| 南宫市| 涞水县| 天峻县| 怀仁县| 乌什县| 通海县| 耒阳市| 巨野县| 正蓝旗| 岫岩| 新田县| 太仓市| 张家口市| 堆龙德庆县| 泰和县| 伊宁县| 卓尼县| 上杭县| 和田市| 长兴县| 古丈县| 科技| 宜昌市| 吉隆县| 宝坻区| 武城县| 大渡口区| 天峻县| 收藏| 沙湾县|