Java File Append Text appendText(String path, String text)

Here you can find the source of appendText(String path, String text)

Description

append Text

License

Open Source License

Declaration

public static boolean appendText(String path, String text) 

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 appendText(String path, String text) {

        try {//from ww w. java 2s  .  c o m

            File file = new File(path);

            System.out.println("file:" + file.getPath());

            BufferedWriter writer = new BufferedWriter(new FileWriter(file, true));

            writer.write(text);

            writer.close();

            return true;

        } catch (Exception e) {

            e.printStackTrace();

        }

        return false;

    }
}

Related

  1. appendText(File f, String text)
  2. appendText(String out, String text)
  3. appendTextString(File outputFile, String doc)
  4. appendTextToFile(@Nonnull File target, String text)
  5. appendTextToFile(File fileToAppend, Set linesToAppend)
  6. appendTextToFile(String file, String text)