writing the object state to a textfile
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sudheer_sannareddy
Posted On:   Thursday, April 15, 2004 03:36 AM

how can we store the state of an object to a text file?

thanks & regards

sudheer

Re: writing the object state to a textfile

Posted By:   Simon_Ablett  
Posted On:   Thursday, April 15, 2004 03:51 AM

You could serialise the whole object (implement the Serializable interface and then use ObjectOuputStream / ObjectInputStream to write / read it) but this would result in a binary rather than a text file. Or just get each of its attributes and write them out individually. Alternatively, define a toString method for the class that generates a string representation of it with the structure you require and write that out.

Regards.
About | Sitemap | Contact