Here you can find the source of saveStringToFile(String fileToSave, String data)
public static boolean saveStringToFile(String fileToSave, String data)
//package com.java2s; //License from project: Open Source License import java.io.FileWriter; import java.io.IOException; import java.io.Writer; public class Main { public static boolean saveStringToFile(String fileToSave, String data) { Writer fw = null;/* ww w .j av a 2 s . co m*/ try { fw = new FileWriter(fileToSave); fw.write(data); fw.append('\n'); } catch (IOException e) { e.printStackTrace(); return false; } finally { if (fw != null) try { fw.close(); } catch (IOException e) { } } return true; } }