Here you can find the source of appendToFile(String content, String filename)
public static void appendToFile(String content, String filename) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; public class Main { public static void appendToFile(String content, String filename) throws IOException { BufferedWriter out = null; try {//from w w w . java 2s. c o m out = new BufferedWriter(new FileWriter(filename, true)); out.write(content); } catch (IOException e) { throw e; } finally { if (out != null) { out.close(); } } } }