equal
deleted
inserted
replaced
53 * NotSerializableException will be thrown and will identify the class |
53 * NotSerializableException will be thrown and will identify the class |
54 * of the non-serializable object. <p> |
54 * of the non-serializable object. <p> |
55 * |
55 * |
56 * Classes that require special handling during the serialization and |
56 * Classes that require special handling during the serialization and |
57 * deserialization process must implement special methods with these exact |
57 * deserialization process must implement special methods with these exact |
58 * signatures: <p> |
58 * signatures: |
59 * |
59 * |
60 * <PRE> |
60 * <PRE> |
61 * private void writeObject(java.io.ObjectOutputStream out) |
61 * private void writeObject(java.io.ObjectOutputStream out) |
62 * throws IOException |
62 * throws IOException |
63 * private void readObject(java.io.ObjectInputStream in) |
63 * private void readObject(java.io.ObjectInputStream in) |
99 * deserialized objects properly despite a "hostile" or incomplete source |
99 * deserialized objects properly despite a "hostile" or incomplete source |
100 * stream. |
100 * stream. |
101 * |
101 * |
102 * <p>Serializable classes that need to designate an alternative object to be |
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 |
103 * used when writing an object to the stream should implement this |
104 * special method with the exact signature: <p> |
104 * special method with the exact signature: |
105 * |
105 * |
106 * <PRE> |
106 * <PRE> |
107 * ANY-ACCESS-MODIFIER Object writeReplace() throws ObjectStreamException; |
107 * ANY-ACCESS-MODIFIER Object writeReplace() throws ObjectStreamException; |
108 * </PRE><p> |
108 * </PRE><p> |
109 * |
109 * |
113 * protected and package-private access. Subclass access to this method |
113 * protected and package-private access. Subclass access to this method |
114 * follows java accessibility rules. <p> |
114 * follows java accessibility rules. <p> |
115 * |
115 * |
116 * Classes that need to designate a replacement when an instance of it |
116 * Classes that need to designate a replacement when an instance of it |
117 * is read from the stream should implement this special method with the |
117 * is read from the stream should implement this special method with the |
118 * exact signature.<p> |
118 * exact signature. |
119 * |
119 * |
120 * <PRE> |
120 * <PRE> |
121 * ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException; |
121 * ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException; |
122 * </PRE><p> |
122 * </PRE><p> |
123 * |
123 * |
131 * If the receiver has loaded a class for the object that has a different |
131 * If the receiver has loaded a class for the object that has a different |
132 * serialVersionUID than that of the corresponding sender's class, then |
132 * serialVersionUID than that of the corresponding sender's class, then |
133 * deserialization will result in an {@link InvalidClassException}. A |
133 * deserialization will result in an {@link InvalidClassException}. A |
134 * serializable class can declare its own serialVersionUID explicitly by |
134 * serializable class can declare its own serialVersionUID explicitly by |
135 * declaring a field named <code>"serialVersionUID"</code> that must be static, |
135 * declaring a field named <code>"serialVersionUID"</code> that must be static, |
136 * final, and of type <code>long</code>:<p> |
136 * final, and of type <code>long</code>: |
137 * |
137 * |
138 * <PRE> |
138 * <PRE> |
139 * ANY-ACCESS-MODIFIER static final long serialVersionUID = 42L; |
139 * ANY-ACCESS-MODIFIER static final long serialVersionUID = 42L; |
140 * </PRE> |
140 * </PRE> |
141 * |
141 * |