Here you can find the source of saveStringToFile(String text, String path)
public static void saveStringToFile(String text, String path)
//package com.java2s; import java.io.*; public class Main { public static void saveStringToFile(String text, String path) { PrintWriter writer = null; try {/*from w ww . j av a 2s . c o m*/ writer = new PrintWriter(path, "UTF-8"); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } writer.write(text); writer.close(); } }