java写文件
写:
/**
* 写文件
* @param path
* @return
* @throws IOException
*/
public BufferedWriter writeFile(final String path) throws IOException {
BufferedWriter writer = new BufferedWriter(new FileWriter(path));
return writer;
}
写完别忘了关闭:
writer.close();
eg.
writer.writer("hello, world"); writer.newLine(); // 新的一行 wirter.close; // 写完记得关闭