1 Star 0 Fork 1.4K

javaalpha/DocSys

forked from Rainy/DocSys 
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
PropertiesUtil.java 877 Bytes
Copy Edit Raw Blame History
zju_rain authored 2017-09-28 11:12 +08:00 . DocSys First Version
package util;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class PropertiesUtil {
private Properties properties = null;
PropertiesUtil(String name) throws IOException{
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
properties = new Properties();
properties.load(stream);
}
public static PropertiesUtil getInstance(String name){
try {
return new PropertiesUtil(name + ".properties");
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public String getProperty(String key) throws Exception{
return properties.getProperty(key);
}
public String getProperty(String key, String def){
String ret = null;
try{
ret = getProperty(key);
}
catch (Exception e){
e.printStackTrace();
return def;
}
return ret;
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/javaalpha/DocSys.git
git@gitee.com:javaalpha/DocSys.git
javaalpha
DocSys
DocSys
master

Search