Hi What you can do is when you open a file, read it & store in a String variable & while writing in that file just write the same string with appending it by what you want to add in that string. Hope it works.
FileOutputStream public FileOutputStream(String name, boolean append) throws FileNotFoundException Creates an output file stream to write to the file with the specified name. If the second argument is true, then bytes will be written to the end of the file rather than the beginning. A new FileDescriptor object is created to represent this file connection. First, if there is a security manager, its checkWrite method is called with name as its argument. If the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason then a FileNotFoundException is thrown. Parameters: name - the system-dependent file name append - if true, then bytes will be written to the end of the file rather than the beginning
The java.io.FileWriter also has the same feature in one of its constructors ... new FileWriter("myfile.txt",true) will append to the file rather than overwrite it. You may also want to look at RandomAccessFile though I don't recommend it ... I don't think that class is very friendly. ------------------ Chris Stehno (Sun Certified Programmer for the Java 2 Platform)