Here you can find the source of appendFile(String file, String text)
public static int appendFile(String file, String text)
//package com.java2s; import java.io.BufferedWriter; import java.io.FileWriter; public class Main { public static int appendFile(String file, String text) { return appendFile(file, text, null); }/* ww w. ja v a 2s .c o m*/ public static int appendFile(String file, String text, String encoding) { int rtn = 0; try { FileWriter fw = new FileWriter(file, true); if (fw != null) { BufferedWriter bw = new BufferedWriter(fw); if (encoding == null) { bw.append(text); } else { bw.append(new String(text.getBytes(), encoding)); } bw.flush(); bw.close(); fw.close(); } } catch (Exception e) { e.printStackTrace(); rtn = 1; } return rtn; } }