/**
* 修改properties文件的某个属性
*
* @param map
* @return
*/
public boolean updateProperties(String key, String value, String propertiesFilePath) {
Properties properties = new Properties();
try {
FileInputStream fis = new FileInputStream(propertiesFilePath);
properties.load(fis);
fis.close();
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
properties.setProperty(key, value);
try {
OutputStream fos = new FileOutputStream(propertiesFilePath);
try {
properties.store(fos, properties.toString());
} catch (IOException e) {
e.printStackTrace();
return false;
} finally {
try {
fos.close();// 关闭输出流
} catch (IOException e) {
e.printStackTrace();
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
return false;
}
return true;
}