Object Serialization
Author |
Message |
Dreamcite
|
Posted: Fri Dec 19, 2008 9:23 pm Post subject: 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? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
HellblazerX
![](http://www.plamania.co.kr/shopimages/plmtest/2910040000213.jpg)
|
Posted: Fri Dec 19, 2008 9:29 pm Post subject: RE:Object Serialization |
|
|
Why not store the information in your own format? |
|
|
|
|
![](images/spacer.gif) |
|
|