Here you can find the source of appendToFile(String filepath, String newLine)
Parameter | Description |
---|---|
filepath | - path to file to append to |
newLine | - new line to append |
Parameter | Description |
---|---|
IOException | - if there is an error opening the file |
public static void appendToFile(String filepath, String newLine) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { /**//from w ww . j av a2 s . c o m * Append string to file in a new line * @param filepath - path to file to append to * @param newLine - new line to append * @throws IOException - if there is an error opening the file */ public static void appendToFile(String filepath, String newLine) throws IOException { FileWriter fstream = new FileWriter(filepath, true); PrintWriter out = new PrintWriter(fstream); out.println(newLine); //Close the output stream out.close(); } }