---
title: "读起配置文件"
author: "fudehai001"
date: "2008-12-08T22:34:14Z"
tags: []
slug: "untitled"
draft: false
lastmod: "2008-12-08T22:35:02Z"
id: 289093
url: "https://laozy.iteye.com/blog/289093"
---

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+"："+code);
            }
        }
        return map;
    }