A set of stream writer and reader classes and methods enable object
frameworks to communicate with each other despite problems with missing
classes due to mismatched versions. The stream writers are modified to
deal with a new version of a class that extends from a class in an
existing version by writing alternate object information compatible with
the existing version when the future object class information is streamed.
In this manner, alternate object information is written for each older
version. The information for each of the alternate objects corresponding
to each older version is added after the existing object information as an
extension with the length of the extension written at the beginning. The
stream readers are modified so that when an older version stream reader
reads the object information and does not understand the first alternate
object (which might correspond to a later version), it skips the length
specified for that extension and reads the second alternate object. If the
second alternate object information is not understood, the reader skips
the non-understood object information and continues with each alternate
object. If none of the alternates is understood, then an exception is
thrown. In one embodiment, the information for alternate objects which are
not used is not discarded, but is instead saved in a temporary storage.
Then, if the object is streamed out again, the stored information is added
back into the stream.