首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

Java读取Properties资料

2012-09-12 
Java读取Properties文件import java.io.IOExceptionimport java.io.InputStreamimport java.util.Proper

Java读取Properties文件

import java.io.IOException;import java.io.InputStream;import java.util.Properties;/** * properties文件操作类 * * @author wsz * @createTime 2012-4-12 * @version 1.0 */public class PropertiesUtil {private static Properties properties = new Properties();private static InputStream inputStream = PropertiesUtil.class.getResourceAsStream("/sourceSystem.properties");/** * 通过key获取对应的value *  * @param key * @return */    public static String getSourceSystemValue(String key) {try {properties.load(inputStream);} catch (IOException e) {e.printStackTrace();}return properties.getProperty(key);    }}

?

热点排行