1、
try { String newPath = parentFilePath + "\\" + fileName; File file = new File(newPath); if (!file.exists()) { file.createNewFile(); } out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, false))); out.write(conent); } catch (Exception e) { System.out.println("写入LOG失败:" + conent); } finally { try { if (out != null) { out.close(); } } catch (IOException e) { System.out.println("关闭写文件失败"); } }
标签:newPath,java,写入,System,file,new,txt,out From: https://www.cnblogs.com/wwssgg/p/17003947.html