Here you can find the source of appendToFile(String filePath, String content)
Parameter | Description |
---|---|
filePath | a parameter |
content | a parameter |
Parameter | Description |
---|---|
IOException | an exception |
public static void appendToFile(String filePath, String content) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { private static final String LINE_BREAK = "\n"; /**/*w ww. j a va 2 s. co m*/ * @param filePath * @param content * @throws IOException */ public static void appendToFile(String filePath, String content) throws IOException { BufferedWriter bw; bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filePath, true))); bw.write(content + LINE_BREAK); bw.flush(); bw.close(); } }