1 Star 0 Fork 1.4K

java-utils/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
ReadProperties.java 813 Bytes
Copy Edit Raw Blame History
zju_rain authored 2017-09-28 11:12 +08:00 . DocSys First Version
/**
* @Title: ReadProperties.java
* @Package util
* @Description: TODO
* @author zhanjp
* @date 2016年7月29日
*/
package util;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;
/**
* ClassName: ReadProperties
* @Description: TODO
* @author zhanjp
* @date 2016年7月29日
*/
public class ReadProperties {
public static String read(String fileName, String key){
try {
Properties props = new Properties();
String basePath = new ReadProperties().getClass().getClassLoader().getResource("/").getPath();
File config = new File(basePath+fileName);
InputStream in = new FileInputStream(config);
props.load(in);
return (String) props.get(key);
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/java-utils/DocSys.git
git@gitee.com:java-utils/DocSys.git
java-utils
DocSys
DocSys
master

Search