Here you can find the source of writeToFile(File file, String content)
public static void writeToFile(File file, String content)
//package com.java2s; //License from project: Open Source License import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; public class Main { public static void writeToFile(File file, String content) { try {// w ww. ja v a 2 s . c o m FileWriter fstream = new FileWriter(file, true); BufferedWriter out = new BufferedWriter(fstream); out.write(content); out.close(); } catch (IOException e) { throw new RuntimeException(e); } } }