Here you can find the source of appendFile(String source, String filetoappend)
public static void appendFile(String source, String filetoappend)
//package com.java2s; // SOLUTIONS CORP. OR ITS LICENSORS. import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; public class Main { public static void appendFile(String source, String filetoappend) { try {/*from ww w .j a va2 s. com*/ boolean append = true; File filesrc = new File(source); BufferedWriter output = new BufferedWriter(new FileWriter( filesrc, append)); File ftoappend = new File(filetoappend); BufferedReader br = new BufferedReader( new FileReader(ftoappend)); String line = br.readLine(); while (line != null) { output.write(line); output.newLine(); line = br.readLine(); } output.close(); br.close(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }