国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JSP > 正文

Properties 持久的屬性集的實例詳解

2020-07-27 21:19:38
字體:
來源:轉載
供稿:網友

Properties 持久的屬性集的實例詳解

特點:

1、Hashtable的子類,map集合中的方法都可以用。

2、該集合沒有泛型。鍵值都是字符串。

3、它是一個可以持久化的屬性集。鍵值可以存儲到集合中,也可以存儲到持久化的設備(硬盤、U盤、光盤)上。鍵值的來源也可以是持久化的設備。

// 根據key讀取value    public void readValue(String filePath, String key) {        Properties props = new Properties();        InputStream in = new BufferedInputStream(new FileInputStream(filePath));  //Thread.currentThread().getContextClassLoader().getResourceAsStream("eop.properties");        props.load(in); // 從輸入流中讀取屬性列表(鍵和元素對)      String value = props.getProperty(key);    }      // 讀取properties的全部信息    public static void readProperties(String filePath) {      Properties props = new Properties();      InputStream in = new BufferedInputStream(new FileInputStream(filePath));        props.load(in);        Enumeration en = props.propertyNames();      while (en.hasMoreElements()) {        String key = (String) en.nextElement();        String value = props.getProperty(key);      }    }  

如有疑問請留言或者到本站社區交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 五寨县| 宜黄县| 昭苏县| 慈溪市| 庆阳市| 巴南区| 青浦区| 澎湖县| 金阳县| 碌曲县| 花莲市| 怀集县| 大兴区| 巴林右旗| 永兴县| 贵州省| 犍为县| 井陉县| 宁强县| 来宾市| 兴国县| 环江| 怀集县| 德令哈市| 广昌县| 三台县| 诏安县| 乌什县| 松江区| 涪陵区| 盐亭县| 江都市| 广德县| 松溪县| 民勤县| 惠州市| 简阳市| 宕昌县| 安新县| 平潭县| 阿尔山市|