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

          歡迎光臨! 
          閑聊 QQ:1074961813

          隨筆分類(357)

          我管理的群

          公共blog

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

          參與管理的論壇

          好友的blog

          我的其他blog

          朋友的網站

          搜索

          •  

          最新評論

          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類的構造函數
          示例: 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()靜態方法
          示例: InputStream in = ClassLoader.getSystemResourceAsStream(name);
                 Properties p = new Properties();
                 p.load(in);

          補充

          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
          主站蜘蛛池模板: 兴安盟| 曲沃县| 子洲县| 云霄县| 颍上县| 哈尔滨市| 潼南县| 舞阳县| 芮城县| 宜良县| 体育| 莱芜市| 安乡县| 汉寿县| 枞阳县| 梁河县| 滕州市| 长寿区| 分宜县| 乌什县| 德兴市| 白沙| 弋阳县| 祁连县| 鸡西市| 富源县| 翼城县| 万年县| 东乡族自治县| 赫章县| 盖州市| 九江市| 唐河县| 兴业县| 北碚区| 秭归县| 东源县| 湖南省| 偃师市| 浦江县| 余姚市|