67 * </PRE> 68 * 69 * <p>The writeObject method is responsible for writing the state of the 70 * object for its particular class so that the corresponding 71 * readObject method can restore it. The default mechanism for saving 72 * the Object's fields can be invoked by calling 73 * out.defaultWriteObject. The method does not need to concern 74 * itself with the state belonging to its superclasses or subclasses. 75 * State is saved by writing the individual fields to the 76 * ObjectOutputStream using the writeObject method or by using the 77 * methods for primitive data types supported by DataOutput. 78 * 79 * <p>The readObject method is responsible for reading from the stream and 80 * restoring the classes fields. It may call in.defaultReadObject to invoke 81 * the default mechanism for restoring the object's non-static and 82 * non-transient fields. The defaultReadObject method uses information in 83 * the stream to assign the fields of the object saved in the stream with the 84 * correspondingly named fields in the current object. This handles the case 85 * when the class has evolved to add new fields. The method does not need to 86 * concern itself with the state belonging to its superclasses or subclasses. 87 * State is saved by writing the individual fields to the 88 * ObjectOutputStream using the writeObject method or by using the 89 * methods for primitive data types supported by DataOutput. 90 * 91 * <p>The readObjectNoData method is responsible for initializing the state of 92 * the object for its particular class in the event that the serialization 93 * stream does not list the given class as a superclass of the object being 94 * deserialized. This may occur in cases where the receiving party uses a 95 * different version of the deserialized instance's class than the sending 96 * party, and the receiver's version extends classes that are not extended by 97 * the sender's version. This may also occur if the serialization stream has 98 * been tampered; hence, readObjectNoData is useful for initializing 99 * deserialized objects properly despite a "hostile" or incomplete source 100 * stream. 101 * 102 * <p>Serializable classes that need to designate an alternative object to be 103 * used when writing an object to the stream should implement this 104 * special method with the exact signature: 105 * 106 * <PRE> 107 * ANY-ACCESS-MODIFIER Object writeReplace() throws ObjectStreamException; 108 * </PRE><p> 109 * | 67 * </PRE> 68 * 69 * <p>The writeObject method is responsible for writing the state of the 70 * object for its particular class so that the corresponding 71 * readObject method can restore it. The default mechanism for saving 72 * the Object's fields can be invoked by calling 73 * out.defaultWriteObject. The method does not need to concern 74 * itself with the state belonging to its superclasses or subclasses. 75 * State is saved by writing the individual fields to the 76 * ObjectOutputStream using the writeObject method or by using the 77 * methods for primitive data types supported by DataOutput. 78 * 79 * <p>The readObject method is responsible for reading from the stream and 80 * restoring the classes fields. It may call in.defaultReadObject to invoke 81 * the default mechanism for restoring the object's non-static and 82 * non-transient fields. The defaultReadObject method uses information in 83 * the stream to assign the fields of the object saved in the stream with the 84 * correspondingly named fields in the current object. This handles the case 85 * when the class has evolved to add new fields. The method does not need to 86 * concern itself with the state belonging to its superclasses or subclasses. 87 * State is restored by reading data from the ObjectInputStream for 88 * the individual fields and making assignments to the appropriate fields 89 * of the object. Reading primitive data types is supported by DataInput. 90 * 91 * <p>The readObjectNoData method is responsible for initializing the state of 92 * the object for its particular class in the event that the serialization 93 * stream does not list the given class as a superclass of the object being 94 * deserialized. This may occur in cases where the receiving party uses a 95 * different version of the deserialized instance's class than the sending 96 * party, and the receiver's version extends classes that are not extended by 97 * the sender's version. This may also occur if the serialization stream has 98 * been tampered; hence, readObjectNoData is useful for initializing 99 * deserialized objects properly despite a "hostile" or incomplete source 100 * stream. 101 * 102 * <p>Serializable classes that need to designate an alternative object to be 103 * used when writing an object to the stream should implement this 104 * special method with the exact signature: 105 * 106 * <PRE> 107 * ANY-ACCESS-MODIFIER Object writeReplace() throws ObjectStreamException; 108 * </PRE><p> 109 * |