隨筆 - 303  文章 - 883  trackbacks - 0
          <2007年8月>
          2930311234
          567891011
          12131415161718
          19202122232425
          2627282930311
          2345678

          歡迎光臨! 
          閑聊 QQ:1074961813

          隨筆分類(357)

          我管理的群

          公共blog

          • n維空間
          • Email : java3d@126.com 群 : 12999758

          參與管理的論壇

          好友的blog

          我的其他blog

          朋友的網(wǎng)站

          搜索

          •  

          最新評論

          from = > http://www.javaeye.com/topic/70281

          1。使用java.util.Properties類的load()方法
          示例: InputStream in = lnew BufferedInputStream(new FileInputStream(name));
                 Properties p = new Properties();
                 p.load(in);

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

          3。使用java.util.PropertyResourceBundle類的構(gòu)造函數(shù)
          示例: InputStream in = new BufferedInputStream(new FileInputStream(name));
                 ResourceBundle rb = new PropertyResourceBundle(in);

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

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

          6。使用java.lang.ClassLoader類的getSystemResourceAsStream()靜態(tài)方法
          示例: InputStream in = ClassLoader.getSystemResourceAsStream(name);
                 Properties p = new Properties();
                 p.load(in);

          補(bǔ)充

          Servlet中可以使用javax.servlet.ServletContext的getResourceAsStream()方法
          示例:InputStream in = context.getResourceAsStream(path);
                 Properties p = new Properties();
                 p.load(in);



          地震讓大伙知道:居安思危,才是生存之道。
          posted on 2007-08-31 19:50 小尋 閱讀(402) 評論(0)  編輯  收藏 所屬分類: j2se/j2ee/j2me
          主站蜘蛛池模板: 孙吴县| 福州市| 台东市| 连山| 凤翔县| 江都市| 皋兰县| 莆田市| 万山特区| 常德市| 达日县| 手游| 金阳县| 濮阳县| 贡嘎县| 盐山县| 邓州市| 余干县| 威信县| 毕节市| 乌鲁木齐市| 邓州市| 苗栗市| 大石桥市| 荔浦县| 信宜市| 防城港市| 茂名市| 茌平县| 瓦房店市| 延川县| 商水县| 迁安市| 玉溪市| 天峨县| 武川县| 红河县| 容城县| 余姚市| 都江堰市| 中牟县|