public class PropertiesUtils {
private static Properties properties = null;
static {
if(null == properties){
properties = new Properties();
InputStreamReader reader = null;
try{
reader = new InputStreamReader(PropertiesUtils.class.getClassLoader().getResourceAsStream("resources.properties"),"utf-8");
properties.load(reader);
reader.close();
}catch (Exception e){
e.printStackTrace();
}finally {
if(reader != null){
reader = null;
}
}
}
}
private PropertiesUtils(){}
public static String getString(String key){
return properties.getProperty(key);
}
}
[java]PropertiesUtils操作属性文件
最新推荐文章于 2021-02-18 20:10:11 发布