folderName=
fileName=
file.properties
怎么单独修改其中一个属性的内容?
public synchronized static void writeStringValue(String fileName, String propertyName, String propertyValue) {
Properties prop = new Properties();
try {
InputStream inputStream = new FileInputStream(fileName);
//get the property list from the stream,it based thread...
prop.load(inputStream);
OutputStream fos = new FileOutputStream(fileName);
prop.setProperty(propertyName, propertyValue);
//add or update the parameter,and add some comment...
prop.store(fos, "Last Modified");
inputStream.close();
} catch (IOException unused) {
}
}
可变属性不放在动态资源中,在运行项目的时候通过Java参数传入进去。