Java File Append appendFile(String filename, String text)

Here you can find the source of appendFile(String filename, String text)

Description

append File

License

Open Source License

Declaration

public static void appendFile(String filename, String text)
            throws IOException 

Method Source Code

//package com.java2s;
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 void appendFile(String filename, String text)
            throws IOException {
        PrintWriter out = new PrintWriter(new BufferedWriter(
                new FileWriter(filename, true)));
        out.println(text);//from ww w  . j  a v  a2 s  .  com
        out.close();
    }

    public static void appendFile(File f, String text) throws IOException {
        PrintWriter out = new PrintWriter(new BufferedWriter(
                new FileWriter(f, true)));
        out.println("the text");
        out.close();
    }
}

Related

  1. appendFile(String file, String content)
  2. appendFile(String file, String text)
  3. appendFile(String fileContents, File toFile)
  4. appendFile(String fileName, byte[] data)
  5. appendFile(String fileName, String content)
  6. appendFile(String filename, String text)
  7. appendFile(String fileName, StringBuffer sb)
  8. appendFile(String fullName, String text)
  9. appendFile(String path, String content)