Here you can find the source of appendStringToFile(File file, String string)
public static File appendStringToFile(File file, String string)
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileWriter; import java.io.IOException; public class Main { public static File appendStringToFile(File file, String string) { FileWriter fileWriter = null; try {//from www . j a v a 2 s. c o m fileWriter = new FileWriter(file, true); fileWriter.append(string); } catch (IOException e) { e.printStackTrace(); } finally { try { fileWriter.flush(); } catch (IOException e) { e.printStackTrace(); } try { fileWriter.close(); } catch (IOException e) { e.printStackTrace(); } } return file; } }