Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

regarding replacing serialized objects in a file

807607Oct 23 2006 — edited Oct 25 2006
hello all,

i have some serialized objects of a class written into a binary file, the format is something like

header1Object1header2Object2header3Object3............so on

i am extracting all the objects into an arrayList, do some modifications and again serialize them back to the file.

however i may need to do the re-writing many time, and this may cause some performance issues (the serialized data are SMS and i may have over 40000+such data so reading and writing all the objects in-and-out may not be a good solution)

is there any way such that objects can simply be 'replaced',
i.e. i have 10 objects in the binary file

-as of now i read all the 10 objects, do some validation/modification
and rewrite all the 10 objects back.

but in-reality changes may have been made only to the 4rth object, but still all the remaining objects need to be written/serialized back. is there some way to replace the desired object with another.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 22 2006
Added on Oct 23 2006
10 comments
316 views