The resolveObject method is used by trusted subclasses to enable the monitoring or substitution of one object for another during deserialization. Resolving objects must be enabled explicitly by calling enableResolveObject before calling readObject for the first object to be resolved. Once enabled resolveObject is called once for each serializable object just prior to the first time it is being returned from readObject. A subclass's implementation may return a substitute object that will be assigned or returned instead of the original. The object returned must be of a type that is consistent and assignable to every reference to the original object or else a ClassCastException is thrown.
All assignments are type-checked.
All references in the stream to the original object will be replaced by references to the substitute object. The enableResolveObject method is used by trusted subclasses of ObjectOutputStream to enable the monitoring or substitution of one object for another during deserialization. Replacing objects is disabled until enableResolveObject is called with a true value. It may thereafter be disabled by setting it to false . The previous setting is returned.