writeReplace
protected Object writeReplace()
throws ObjectStreamException
The writeReplace method is called when ObjectOutputStream is preparing to write the object to the
stream. The ObjectOutputStream checks whether the class defines the writeReplace method. If the method
is defined, the writeReplace method is called to allow the object to designate its replacement in the
stream. The object returned should be either of the same type as the object passed in or an object that
when read and resolved will result in an object of a type that is compatible with all references to the
object.
- Throws:
ObjectStreamException - when problem occurs on serialization