• Post Reply Bookmark Topic Watch Topic
  • New Topic

serialization question  RSS feed

 
Nishant Verma
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a question on Serialization. Reference JDK 1.4 Java documentation on ObjectInputStream and ObjectOutputStream.

You can create your own trusted streams by extending ObjectInputStream and ObjectOutputStream. And subsitute a non-serializable object with the serializable one, before writing that to output stream. On the reader end you can resolve, the object and return another to the user. Is this the correct sequence of calls ???

serialization : replaceObject -> writeObject.
deserialization : resolveObject -> readObject. Or resolveobject is called within readObject

Any help will be greatly appreciated.

Thanks
Nishant
 
Vladimir Nesov
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that's right. Nice trick with replacing in-stream. I used to add writeReplace() to third-party code.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!