Here you can find the source of appendStringToFile(final String path, final String output)
Parameter | Description |
---|---|
path | A path to a file |
output | A text to write to a file |
Parameter | Description |
---|---|
IOException | an exception |
public static void appendStringToFile(final String path, final String output)
//package com.java2s; //License from project: Open Source License import java.io.FileWriter; import java.io.IOException; public class Main { /**// w w w. j a va 2 s. c o m * This method appends a string to a textfile * * @param path * A path to a file * @param output * A text to write to a file * @throws IOException */ public static void appendStringToFile(final String path, final String output) { try { FileWriter fw = new FileWriter(path, true); fw.append(output); fw.close(); } catch (IOException e) { e.printStackTrace(); } } }