Can Serialzation be customized to write objects in a human readable and modifiable form?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Tom_Chang
Posted On:   Monday, April 9, 2001 12:48 PM

I'm trying to save the state of a particular object to a file, which would be read later to restore the last state of the object. Using Serialization accomplishes this, but the file to which the object is saved is in binary format.


Is there a way, perhaps by customizing the writeObject and ReadObject methods, to have details of an object written out in a human readable format? The objective of this is to allow users to manually check and modify the text file, perhaps to change the values of some fields. The next time the program loads, it would read this object from the file, reflecting the changed values while preserving unchanged values.

Thank you.

Re: Can Serialzation be customized to write objects in a human readable and modifiable form?

Posted By:   AlessandroA_Garbagnati  
Posted On:   Monday, April 9, 2001 01:01 PM

Tom,

Well, if you want to customize those methods you can extend them and make your modifications.

But have you considered to use another solution, XML, for example?

Take a look at this article from JavaWorld: Mapping XML to Java part 1 and part 2
About | Sitemap | Contact