程序笔记   发布时间:2022-05-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了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);  
    }  
  }  

如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

大佬总结

以上是大佬教程为你收集整理的Properties 持久的属性集的实例详解全部内容,希望文章能够帮你解决Properties 持久的属性集的实例详解所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:持久