【发布时间】:2012-01-19 11:20:12
【问题描述】:
考虑以下功能
private static void GetText(String nodeValue) throws IOException {
if(!file3.exists()) {
file3.createNewFile();
}
FileOutputStream fop=new FileOutputStream(file3,true);
if(nodeValue!=null)
fop.write(nodeValue.getBytes());
fop.flush();
fop.close();
}
要添加什么让它每次都写在下一行?
例如,我希望给定字符串的每个单词在单独的行中,例如:
i am mostafa
写成:
i
am
mostafa
【问题讨论】:
-
您可以删除
f.exists()/f.createNewFile()的东西。new FileOutputStream()已经这样做了。