Here you can find the source of writeStringToFile(String fileName, String src)
public static boolean writeStringToFile(String fileName, String src)
//package com.java2s; import java.io.FileWriter; import java.io.IOException; public class Main { public static boolean writeStringToFile(String fileName, String src) { if (src == null) { src = ""; }/*from ww w .j a v a 2s. co m*/ boolean isOk = true; FileWriter out = null; try { out = new FileWriter(fileName); out.write(src); out.close(); } catch (IOException e) { isOk = false; e.printStackTrace(); } catch (Exception e) { isOk = false; e.printStackTrace(); } finally { out = null; } return isOk; } }