
-----------------------------------
Dreamcite
Fri Dec 19, 2008 9:23 pm

Object Serialization
-----------------------------------
Hi Everyone.

I have a problem where objects cannot be read using ObjectInputStream. I have a pretty good idea on what the error is caused by, but I'd like to make sure and also figure out how to overcome the problem.

I don't have any sample codes but an example should suffice.

I make an application that takes orders from customers and serializes objects containing relevant information to a file. Once I close the output stream (which I assume it does automatically when the application is closed) opening any additional streams to that file will cause a StreamCorruptedException when reading from it again. I think the error is caused because ObjectOutputStream writes a header in it's constructor, so the file will have several headers and ObjectInputStream only expects a single header.

So is there anyway I can keep writing objects to a single file and retrieve them properly?

-----------------------------------
HellblazerX
Fri Dec 19, 2008 9:29 pm

RE:Object Serialization
-----------------------------------
Why not store the information in your own format?
