Java File Append Text appendTextToFile(String text, File file)

Here you can find the source of appendTextToFile(String text, File file)

Description

append Text To File

License

Open Source License

Declaration

public static void appendTextToFile(String text, File file) 

Method Source Code


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

import java.io.*;

public class Main {
    public static void appendTextToFile(String text, File file) {
        try (FileOutputStream fileOutputStream = new FileOutputStream(file, true)) {
            fileOutputStream.write(text.getBytes());
        } catch (IOException e) {
            throw new RuntimeException("Error while appending text to file", e);
        }//w w w. j  av  a  2 s .com
    }
}

Related

  1. appendTextToFile(File fileToAppend, Set linesToAppend)
  2. appendTextToFile(String file, String text)
  3. appendTextToFile(String file_name, String text)
  4. appendTextToFile(String filename, String data)
  5. AppendTextToFile(String filePath, String text)
  6. appendToFile(File destFile, InputStream source)
  7. appendToFile(File file, String data)
  8. appendToFile(File tempFile, String str)
  9. appendToFile(final File file, final String contents)