properties文件 store后,原来值被修改

sgxu 2018-09-12 10:31:44
这是没有store时文件中的值
jdbc.url=jdbc:mysql://localhost:3306/?useUnicode=true&characterEncoding=utf8
这是store后文件中的值,多加了斜杠
jdbc.url=jdbc\:mysql\://localhost\:3306/xxx?useUnicode\=true&characterEncoding\=utf8

代码如下:

Properties prop = new Properties();
try {
InputStream fis = new FileInputStream(filePath);
prop.load(fis);
prop.setProperty("aaa", "xxx");
prop.store(new OutputStreamWriter(
new FileOutputStream(filePath), "UTF-8"),
new Date().toString());
} catch (IOException e) {
e.printStackTrace();
}

...全文
210 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧