Here you can find the source of AppendTextToFile(String filePath, String text)
Parameter | Description |
---|---|
filePath | Absolute file path |
text | Text to append |
Parameter | Description |
---|---|
Exception | an exception |
public static void AppendTextToFile(String filePath, String text) throws Exception
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.io.*; public class Main { /** Convenience method that appends text to an existing file. *//from ww w . j a v a2s .c om * @param filePath Absolute file path * @param text Text to append * @throws Exception */ public static void AppendTextToFile(String filePath, String text) throws Exception { PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(filePath, true))); out.write(text); out.close(); } }