posts - 5,  comments - 1,  trackbacks - 0

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


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


          3。使用java.util.PropertyResourceBundle類的構(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類的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 阿健 閱讀(210) 評(píng)論(0)  編輯  收藏

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


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

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          相冊(cè)

          BLOG

          Web Site

          搜索

          •  

          最新評(píng)論

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

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 大邑县| 卢湾区| 巴彦淖尔市| 中山市| 江华| 山西省| 万山特区| 饶平县| 正镶白旗| 西峡县| 洛隆县| 卓尼县| 新和县| 达拉特旗| 永胜县| 清徐县| 平罗县| 民丰县| 英德市| 台山市| 垦利县| 于都县| 海城市| 西城区| 葵青区| 邛崃市| 闽侯县| 海淀区| 招远市| 和硕县| 安远县| 鄂伦春自治旗| 三穗县| 竹北市| 开远市| 延寿县| 宽城| 南安市| 拉萨市| 怀仁县| 淮阳县|