黄色电影一区二区,韩国少妇自慰A片免费看,精品人妻少妇一级毛片免费蜜桃AV按摩师 ,超碰 香蕉

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

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);  
    }  
  }  

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

相關文章