Here you can find the source of saveTextFile(String fileName, String text)
public static void saveTextFile(String fileName, String text)
//package com.java2s; //License from project: Open Source License import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; public class Main { public static void saveTextFile(String fileName, String text) { BufferedWriter writer = null; try {//from w w w . ja v a 2s. c o m writer = new BufferedWriter(new FileWriter(fileName)); writer.write(text); } catch (IOException e) { } finally { try { if (writer != null) writer.close(); } catch (IOException e) { } } } }