package util;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class GetProperty {
private String username;
private String password;
private String host;
private String port;
private String DBName;
private String company;
private String parent_wbs_id;
private InputStream inputFile;
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
public String getHost() {
return host;
}
public String getPort() {
return port;
}
public String getDBName() {
return DBName;
}
public String getCompany() {
return company;
}
public String getParent_wbs_id() {
return parent_wbs_id;
}
//读取配置文件
public boolean getProterties(){
Properties propertie=new Properties();
try {
inputFile= GetProperty.class.getResourceAsStream("DB.properties");
propertie.load(inputFile);
username=propertie.getProperty("username");
password=propertie.getProperty("password");
host=propertie.getProperty("host");
port=propertie.getProperty("port");
DBName=propertie.getProperty("DBName");
//company=propertie.getProperty("company");
//parent_wbs_id=propertie.getProperty("parent_wbs_id");
inputFile.close();
} catch (IOException e) {
Log.setLog("读取配置文件出错!请查看DB.properties文件是否配置正确!");
return false;
}
return true;
}
public static String toUnicode(String s) {
String as[] = new String[s.length()];
String s1 = "";
for (int i = 0; i < s.length(); i++) {
as[i] = Integer.toHexString(s.charAt(i) & 0xffff);
s1 = s1 + "" + as[i];
}
return s1;
}
}
阅读(583) | 评论(0) | 转发(0) |