【发布时间】:2019-11-05 14:30:19
【问题描述】:
在我的 Spring boot 应用程序中,我收到了String,现在我想将它们保存为特定目录中的文件。
我该怎么做?
我已经通过this,但它正在接收文件并保存,但我想写入那些文件。
我正在使用此代码,原始 JAVA:
PrintWriter writer = null;
try {
writer = new PrintWriter("file.txt", "UTF_32");
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
writer.println(data);
writer.close();
但这不是每个人都可能想要的,看看吧:
【问题讨论】:
标签: spring spring-boot file