最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Properties 持久的屬性集的實(shí)例詳解

 更新時(shí)間:2017年10月16日 09:02:17   作者:_QING_FENG  
這篇文章主要介紹了Properties 持久的屬性集的實(shí)例詳解的相關(guān)資料,希望通過本文能幫助到大家,需要的朋友可以參考下

Properties 持久的屬性集的實(shí)例詳解

特點(diǎn):

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

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

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

// 根據(jù)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);  
    }  
  }  

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

相關(guān)文章

最新評論

河源市| 盱眙县| 海原县| 桦川县| 平山县| 富顺县| 连城县| 桦川县| 石家庄市| 三原县| 乡宁县| 明光市| 邢台市| 新宾| 新沂市| 明光市| 绥江县| 霍州市| 青川县| 清远市| 莎车县| 潜山县| 淮安市| 张家川| 佛山市| 天峨县| 肇庆市| 洛川县| 高雄县| 曲阳县| 定襄县| 乌拉特中旗| 青田县| 阳泉市| 拜泉县| 崇州市| 沂南县| 荥阳市| 交城县| 新宁县| 巨野县|