Here you can find the source of writeFile(String fileName, String textToSave)
public static void writeFile(String fileName, String textToSave) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static void writeFile(String fileName, String textToSave) throws IOException { if (fileName == null) throw new IOException("filename is null"); if (textToSave == null) throw new IOException("textToSave is null"); FileWriter fw = new FileWriter(fileName); BufferedWriter bw = new BufferedWriter(fw); fw.write(textToSave);/*from w w w . ja v a 2 s .c o m*/ bw.close(); fw.close(); } }