`
fudehai001
  • 浏览: 489857 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

读起配置文件

    博客分类:
  • java
 
阅读更多
public static HashMap readPropertyFile(String file) throws IOException{
        HashMap map = new HashMap();
        InputStream is = FileUtil.class.getResourceAsStream(file);
        Properties properties = new Properties();
        properties.load(is);
        Enumeration en = properties.propertyNames();
        while( en.hasMoreElements()){
            String key=(String)en.nextElement();
            String code = new String(properties.getProperty(key).getBytes("ISO-8859-1"),"gbk");
            map.put(key,code);
            if (GlobalNames.DEBUG_PERFERMANCE_FLAG) {
                System.out.println(file+"["+key+"]:"+code);
            }
        }
        return map;
    }
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics