写:
/** * 写文件 * @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; // 写完记得关闭
时间: 2024-11-03 01:35:54