Here you can find the source of writeFile(String filePath, String text)
public static void writeFile(String filePath, String text)
//package com.java2s; //License from project: Apache License import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; public class Main { public static void writeFile(String filePath, String text) { BufferedWriter bw = null; try {//from w ww .ja v a2s .co m bw = new BufferedWriter(new FileWriter(filePath, true)); bw.write(text); bw.flush(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { try { bw.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } bw = null; } } }