Java Text File Append appendStringToFile(File f, String s)

Here you can find the source of appendStringToFile(File f, String s)

Description

append String To File

License

Open Source License

Declaration

public static boolean appendStringToFile(File f, String s) 

Method Source Code

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

import java.io.BufferedWriter;
import java.io.File;

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

import java.io.PrintWriter;

public class Main {
    public static boolean appendStringToFile(File f, String s) {
        try {/*from w w w .j av  a  2s  . c  o  m*/
            PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f, true)));
            out.println(s);
            out.close();
            return true;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return false;
    }
}

Related

  1. add2File(String fileName, String content)
  2. appendStringToFile(File file, String string)
  3. appendStringToFile(File file, String string)
  4. appendStringToFile(File file, String string)
  5. appendStringToFile(final String path, final String output)