There is a constructor in the java.io.FileOutputStream class which can be used to append data to an existing file.
public FileOutputStream(String name, boolean append)
name - the file name
append - if true, data will be written to the end of the file
So, if you wish to append to a file called fname.dat, you initialize a
FileOutputStream object as follows:
FileOutputStream file = new FileOutputStream