Here you can find the source of writeStringToFile(String data, String filename, boolean append)
public static void writeStringToFile(String data, String filename, boolean append) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; public class Main { public final static String LINE_BREAK = "\015\012"; public static void writeStringToFile(String data, String filename, boolean append) throws IOException { BufferedWriter br = new BufferedWriter(new PrintWriter(new FileWriter(filename, append))); br.write(data);//www.jav a2 s . c om br.write(LINE_BREAK); br.flush(); br.close(); } }