Here you can find the source of appendTextToFile(String file, String text)
Parameter | Description |
---|---|
file | The filename (with full path) to write to |
text | Text to appendto the file |
public static final void appendTextToFile(String file, String text)
//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 { /**/* w ww . j a v a2 s. c o m*/ * Simple method to append text to a file * @param file The filename (with full path) to write to * @param text Text to appendto the file */ public static final void appendTextToFile(String file, String text) { try { PrintWriter out = new PrintWriter(new BufferedWriter( new FileWriter(file, true))); out.print(text); out.close(); } catch (IOException e) { e.printStackTrace(); } } }