Java Text File Write writeStringToFile(final String path, final String output)

Here you can find the source of writeStringToFile(final String path, final String output)

Description

This method appends a string to a textfile

License

Open Source License

Parameter

Parameter Description
path A path to a file
output A text to write to a file

Declaration

public static void writeStringToFile(final String path, final String output) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.FileWriter;
import java.io.IOException;

public class Main {
    /**/*from   www . j av a  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
     */
    public static void writeStringToFile(final String path, final String output) {
        try {
            FileWriter fw = new FileWriter(path, false);
            fw.append(output);
            fw.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Related

  1. writeStringToFile(File outFile, String s)
  2. writeStringToFile(File p_out, String p_str)
  3. writeStringToFile(File pFile, String pString)
  4. writeStringToFile(final File file, final String data)
  5. writeStringToFile(final File file, final String data)
  6. writeStringToFile(final String string, final File file)
  7. writeStringToFile(final String text, final File filePath)
  8. writeStringToFile(String content, File file)
  9. writeStringToFile(String content, File file)