Here you can find the source of writeFileEnd(String filepath, String text)
public static void writeFileEnd(String filepath, String text)
//package com.java2s; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; public class Main { public static void writeFileEnd(String filepath, String text) { OutputStreamWriter wr = null; try {/* ww w . ja v a 2 s . c om*/ File file = new File(filepath); if (!file.exists()) { file.getParentFile().mkdirs(); } wr = new OutputStreamWriter( new FileOutputStream(filepath, true), "UTF8"); wr.write(text); wr.flush(); } catch (Exception e) { e.printStackTrace(); } finally { if (wr != null) { try { wr.close(); } catch (IOException e) { e.printStackTrace(); } } } } }