Serialization stream header
hi,
I have to write objects in a file using serialization and ObjectOutputStream. a header is written at the beginning of the stream/file, before my objects"records".
My trouble is: if i reopen my stream in append mode on the same file, I'll have a second header at the end of the file(after the previous records), all the new records will be added after.In this case, I have the first header at the beginning of the file, some records a new header and the last records...
The trouble is that, when I read the file back with ObjectInputStream, it runs correctly until it reaches the stream header inside the file(the second one written in append)!
what shall I do to avoid this?
thank you in advance,
Michael.
|