Here you can find the source of toFile(String content, File output)
public static void toFile(String content, File output)
//package com.java2s; //License from project: Apache License import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; public class Main { public static void toFile(String content, File output) { try {//w w w. j a v a2 s . com BufferedWriter writer = new BufferedWriter(new FileWriter(output)); writer.write(content); writer.flush(); writer.close(); } catch (IOException e) { throw new RuntimeException(e); } } }