Here you can find the source of writeString(String data, File file)
public static boolean writeString(String data, File file)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; public class Main { /**Writes a String to disk. */ public static boolean writeString(String data, File file) { try {//ww w . ja v a 2s . c om PrintWriter out = new PrintWriter(new FileWriter(file)); out.print(data); out.close(); return true; } catch (IOException e) { System.out.println("Problem writing String to disk!"); e.printStackTrace(); return false; } } }