CONTENTS | PREV | NEXT Java Object Serialization Specification

1.10 The Serializable Interface

Object Serialization produces a stream with information about the JavaTM classes for the objects which are being saved. For serializable objects, sufficient information is kept to restore those objects even if a different (but compatible) version of the implementation of the class is present. The Serializable interface is defined to identify classes which implement the serializable protocol:


public interface Serializable {};
A Serializable class must do the following:

The class can optionally define the following methods:

ObjectOutputStream and ObjectInputStream allow the serializable classes on which they operate to evolve (allow changes to the classes that are compatible with the earlier versions of the classes). See Section 5.5, "Compatible JavaTM Type Evolution" for information about the mechanism which is used to allow compatible changes.

Copyright © 1997-1998 Sun Microsystems, Inc. All Rights Reserved.