Here you can find the source of appendToFile(String outputFile, String contents)
public static void appendToFile(String outputFile, String contents)
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; public class Main { public static void appendToFile(String outputFile, String contents) { try {/*from w w w . j a va2 s .co m*/ Files.write(Paths.get(outputFile), contents.getBytes(), StandardOpenOption.APPEND); } catch (IOException e) { throw new UnsupportedOperationException("Failed to append to file '" + outputFile + "'", e); } } }