public void writeObject (Object oldInstance, Encoder out)

The writeObject is a single entry point to the persistence and is used by a Encoder in the traditional mode of delegation. Although this method is not final, it should not need to be subclassed under normal circumstances.

This implementation first checks to see if the stream has already encountered this object. Next the mutatesTo method is called to see if that candidate returned from the stream can be mutated into an accurate copy of oldInstance. If it can, the initialize method is called to perform the initialization. If not, the candidate is removed from the stream, and the instantiate method is called to create a new candidate for this object.

Parameters:
oldInstance    The instance that will be created by this expression.
out    The stream to which this expression will be written.

Exceptions:
NullPointerException    if out is null