您的位置:首页 > 编程语言 > Java开发

java读写配置文件

2010-07-03 15:14 211 查看
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("user.properties");
Properties p = new Properties();

try {
p.load(inputStream);
String theUserpass=p.getProperty(username);
if (theUserpass!=null && theUserpass.equals(password)){
return true;
}else{
return false;
}
} catch (IOException e1) {
e1.printStackTrace();
}finally{
if (inputStream!=null){
try {
inputStream.close();
} catch (IOException e) {

}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: