Here you can find the source of writeFile(String file, T data, boolean append)
public static <T> void writeFile(String file, T data, boolean append)
//package com.java2s; import java.io.FileWriter; import java.io.IOException; public class Main { public static <T> void writeFile(String file, T data, boolean append) { FileWriter writer = null; try {/*from w w w .ja v a 2 s . co m*/ writer = new FileWriter(file, append); writer.write(data.toString()); writer.flush(); } catch (IOException e) { e.printStackTrace(); } finally { try { writer.close(); } catch (IOException e) { e.printStackTrace(); } } } }