Here you can find the source of writeFile(File file, String data)
public static void writeFile(File file, String data) throws IOException
//package com.java2s; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; public class Main { public static void writeFile(File file, String data) throws IOException { FileWriter fstream = new FileWriter(file); BufferedWriter out = new BufferedWriter(fstream); out.write(data);//from w w w . j av a 2 s . c om out.close(); } }