File txt_file=new File("c:\\file_id.txt");
RandomAccessFile rf = new RandomAccessFile(txt_file, "rw"); long fileLength = rf.length(); // 将本件指针移到文本末尾 rf.seek(fileLength); // 文本文件追加文本,换行符 rf.writeBytes("字符内容\r\n"); rf.close();
第二种办法
File txt_file=new File("c:\\file_id.txt"); FileUtils.writeLines(txt_file, resource_sqlList);