For "ObjectOutputStream", Is there any way to append addition data to file without destroying any existing data.
Below is my code, I try to append "userAccount" object to the end of file. However, it doesn't work. The existing data is over-written by the new data. I looked at the ObjectOutputStream
doc in JavaDoc... ObjectOutputStream doesn't have any "append" mode...
I need to use Object serializable to update the file with addition information. Any idea how to do it?
public void store(Account userAccount) throws IOException {
FileOutputStream fos = new FileOutputStream("c:\\tmp.bin");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(userAccount);
}