Java Text File Append FileAppend(String fileNameWithPath, String content)

Here you can find the source of FileAppend(String fileNameWithPath, String content)

Description

File Append

License

Open Source License

Declaration

public static boolean FileAppend(String fileNameWithPath, String content)
            throws Exception 

Method Source Code

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

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

import java.io.FileWriter;

public class Main {
    public static boolean FileAppend(String fileNameWithPath, String content)
            throws Exception {
        File file = new File(fileNameWithPath);

        // if file doesnt exists, then create it
        if (!file.exists()) {
            file.createNewFile();//from   w  ww  .j  a  v  a 2s .  c om
        }

        FileWriter fw = new FileWriter(file.getAbsoluteFile(), true);
        BufferedWriter bw = new BufferedWriter(fw);
        bw.append(content);
        bw.close();

        return true;
    }
}

Related

  1. appendStringToFile(final String path, final String output)
  2. appendStringToFile(String file, String contents)
  3. appendStringToFile(String fileName, String data)
  4. appendStringToFile(String str, String oFileName)
  5. appendStringToFile(String string, String filename)
  6. fileAppend(String target, String source)
  7. fileAppendString(String target, String source)