Append byte array to a file using FileOutputStream in Java

Description

The following code shows how to append byte array to a file using FileOutputStream.

Example


//w w w  .  j  a  va2 s  .  c  o  m
import java.io.FileOutputStream;

public class Main {
  public static void main(String[] args) throws Exception {
    FileOutputStream fos = new FileOutputStream("test.txt", true);
    fos.write("Appended".getBytes());
    fos.close();
  }
}




















Home »
  Java Tutorial »
    I/O »




Binary File
Byte Array
CharSet
Checksum
Console
Create Copy Move Delete
Directory
Drive
Encode Decode
File Attribute
File Lock
File System
GZIP
Jar File
NIO Buffer
Path
Scanner
StreamTokenizer
Temporary File
Text File
Zip