Here you can find the source of appendToFile(final String filePath, final String textToAppend)
public static boolean appendToFile(final String filePath, final String textToAppend)
//package com.java2s; //License from project: Open Source License import java.io.FileWriter; public class Main { public static boolean appendToFile(final String filePath, final String textToAppend) { try (FileWriter fw = new FileWriter(filePath, true)) { fw.write(textToAppend);/* w w w. j a v a2s . c o m*/ fw.close(); return true; } catch (final Exception e) { return false; } } }