34 * of the class to save and restore the contents of its instances.
35 *
36 * The writeExternal and readExternal methods of the Externalizable
37 * interface are implemented by a class to give the class complete
38 * control over the format and contents of the stream for an object
39 * and its supertypes. These methods must explicitly
40 * coordinate with the supertype to save its state. These methods supersede
41 * customized implementations of writeObject and readObject methods.<br>
42 *
43 * Object Serialization uses the Serializable and Externalizable
44 * interfaces. Object persistence mechanisms can use them as well. Each
45 * object to be stored is tested for the Externalizable interface. If
46 * the object supports Externalizable, the writeExternal method is called. If the
47 * object does not support Externalizable and does implement
48 * Serializable, the object is saved using
49 * ObjectOutputStream. <br> When an Externalizable object is
50 * reconstructed, an instance is created using the public no-arg
51 * constructor, then the readExternal method called. Serializable
52 * objects are restored by reading them from an ObjectInputStream.<br>
53 *
54 * An Externalizable instance can designate a substitution object via
55 * the writeReplace and readResolve methods documented in the Serializable
56 * interface.<br>
57 *
58 * @see java.io.ObjectOutputStream
59 * @see java.io.ObjectInputStream
60 * @see java.io.ObjectOutput
61 * @see java.io.ObjectInput
62 * @see java.io.Serializable
63 * @since 1.1
64 */
65 public interface Externalizable extends java.io.Serializable {
66 /**
67 * The object implements the writeExternal method to save its contents
68 * by calling the methods of DataOutput for its primitive values or
69 * calling the writeObject method of ObjectOutput for objects, strings,
70 * and arrays.
71 *
72 * @serialData Overriding methods should use this tag to describe
73 * the data layout of this Externalizable object.
74 * List the sequence of element types and, if possible,
75 * relate the element to a public/protected field and/or
76 * method of this Externalizable class.
|
34 * of the class to save and restore the contents of its instances.
35 *
36 * The writeExternal and readExternal methods of the Externalizable
37 * interface are implemented by a class to give the class complete
38 * control over the format and contents of the stream for an object
39 * and its supertypes. These methods must explicitly
40 * coordinate with the supertype to save its state. These methods supersede
41 * customized implementations of writeObject and readObject methods.<br>
42 *
43 * Object Serialization uses the Serializable and Externalizable
44 * interfaces. Object persistence mechanisms can use them as well. Each
45 * object to be stored is tested for the Externalizable interface. If
46 * the object supports Externalizable, the writeExternal method is called. If the
47 * object does not support Externalizable and does implement
48 * Serializable, the object is saved using
49 * ObjectOutputStream. <br> When an Externalizable object is
50 * reconstructed, an instance is created using the public no-arg
51 * constructor, then the readExternal method called. Serializable
52 * objects are restored by reading them from an ObjectInputStream.<br>
53 *
54 * An Externalizable object can designate a substitution object via
55 * the writeReplace and readResolve methods documented in the Serializable
56 * interface. To control the serialized form of Records and Externalizable value classes
57 * the record or class uses {@link Serializable} {@code writeReplace}
58 * to delegate to another serializable or externalizable class and that delegate
59 * uses {@code readResolve} to supply the replacement on deserialization.
60 * Value classes implementing {@link Externalizable}
61 * and not using {@code writeReplace} are not supported.
62 * <br>
63 *
64 * @see java.io.ObjectOutputStream
65 * @see java.io.ObjectInputStream
66 * @see java.io.ObjectOutput
67 * @see java.io.ObjectInput
68 * @see java.io.Serializable
69 * @since 1.1
70 */
71 public interface Externalizable extends java.io.Serializable {
72 /**
73 * The object implements the writeExternal method to save its contents
74 * by calling the methods of DataOutput for its primitive values or
75 * calling the writeObject method of ObjectOutput for objects, strings,
76 * and arrays.
77 *
78 * @serialData Overriding methods should use this tag to describe
79 * the data layout of this Externalizable object.
80 * List the sequence of element types and, if possible,
81 * relate the element to a public/protected field and/or
82 * method of this Externalizable class.
|