Here you can find the source of saveToFile(File file, String text)
public static boolean saveToFile(File file, String text)
//package com.java2s; import java.io.File; import java.io.FileWriter; import java.io.PrintWriter; public class Main { public static boolean saveToFile(File file, String text) { try {/*from www.j av a 2s . c o m*/ PrintWriter outStream = new PrintWriter(new FileWriter(file)); outStream.print(text); outStream.close(); return true; } catch (Exception ex) { return false; } } }