Here you can find the source of appendTextToFile(String file_name, String text)
static public void appendTextToFile(String file_name, String text) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileWriter; import java.io.IOException; public class Main { static public void appendTextToFile(String file_name, String text) throws IOException { appendTextToFile(new File(file_name), text); }//from w ww .j a va2 s. com /** * @param file * @param text * @throws IOException */ static public void appendTextToFile(File file, String text) { try { FileWriter writer = new FileWriter(file, true); for (int i = 0; i < text.length(); i++) { int ch = (int) text.charAt(i); writer.write(ch); } writer.write('\n'); writer.flush(); writer.close(); } catch (IOException e) { System.err.println("\nError of append_to_file [" + file + "]: \n" + e); } } }