dcsimg
readObject
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Amulya_Doss
Posted On:   Wednesday, September 12, 2001 02:26 PM

Is it possible to have a class say FileWrite.java which implements serializable and uses writeObject to write to a file
Use another class,FileRead.java which could read the contents of the file created by FileWrite.java
Thanks

Re: readObject

Posted By:   Kevin_Riff  
Posted On:   Sunday, September 16, 2001 10:12 PM

It's certainly possible to put the encoding logic for a particular format in one class and the decoding logic in another. However, the readObject()/writeObject() methods described by the Serializable interface must be in the same class to function correctly. Perhaps what you want is the writeReplace()/readResolve methods, which let you substitute a different object in the stream.
About | Sitemap | Contact