只是
FileWriter
FileWriter fileWritter = new FileWriter("example.properties", true);BufferedWriter bufferWritter = new BufferedWriter(fileWritter);bufferWritter.append("PROPERTES_YOUR_KEY=PROPERTES_YOUR_VALUE");bufferWritter.close();
更新资料
属性API不支持,我不确定为什么需要此功能。
您可以尝试如下:
example.properties
PROPERTIES_KEY_3=PROPERTIES_VALUE_3PROPERTIES_KEY_2=PROPERTIES_VALUE_2PROPERTIES_KEY_1=PROPERTIES_VALUE_1
程序
Properties pop = new Properties();pop.load(new FileInputStream("example.properties"));pop.put("PROPERTIES_KEY_3", "OVERWRITE_VALUE");FileOutputStream output = new FileOutputStream("example.properties");pop.store(output, "This is overwrite file");
输出
PROPERTIES_KEY_3=OVERWRITE_VALUEPROPERTIES_KEY_2=PROPERTIES_VALUE_2PROPERTIES_KEY_1=PROPERTIES_VALUE_1
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)