File file = new File("E:\\workplace\\my_notes\\work_log\\"+fileName);
OutputStreamWriter os=null;
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
try {
os = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8);
os.write("# "+thisYear+"_"+fileName+"工作日志 \r\n\r\n## 任务\r\n\r\n\r\n\r\n## 详细");
} catch (IOException e) {
e.printStackTrace();
}finally {
try {
if(os!=null)
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}