Java File Append appendFile(String path, String content)

Here you can find the source of appendFile(String path, String content)

Description

append File

License

Open Source License

Declaration

public static void appendFile(String path, String content) throws IOException 

Method Source Code


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

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

public class Main {

    public static void appendFile(String path, String content) throws IOException {
        File file = new File(path);
        if (!file.exists()) {
            file.createNewFile();//from   w  w  w  .  j a v  a 2  s  . c  om
        }

        FileOutputStream outputStream = new FileOutputStream(file, true);
        outputStream.write(content.getBytes("utf-8"));
        outputStream.close();
    }
}

Related

  1. appendFile(String fileName, String content)
  2. appendFile(String filename, String text)
  3. appendFile(String filename, String text)
  4. appendFile(String fileName, StringBuffer sb)
  5. appendFile(String fullName, String text)
  6. appendFile(String path, String sb)
  7. appendFile(String source, String filetoappend)
  8. appendFile(String strThrift, String filePath)
  9. appendFileBytes(String srcFileName, String tarFileName)