...
Code Block |
---|
private void writeObject(java.io.ObjectOutputStream out) throws IOException; private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException; private void readObjectNoData() throws ObjectStreamException; |
Note that these methods must be declared private for any serializable class. Serializable classes may also implement the {{ Wiki Markup readResolve()
}} and {{writeReplace()
}} methods.
According to the Serialization Specification \[ [Sun 2006|AA. References#Sun 06]\], {{readResolve()
}} and {{writeReplace()
}} method documentation:
For Serializable and Externalizable classes, the
readResolve
method allows a class to replace/resolve the object read from the stream before it is returned to the caller. By implementing thereadResolve
method, a class can directly control the types and instances of its own instances being deserialized.For Serializable and Externalizable classes, the
writeReplace
method allows a class of an object to nominate its own replacement in the stream before the object is written. By implementing thewriteReplace
method, a class can directly control the types and instances of its own instances being serialized.
...
Bibliography
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="9d878c59-4b31-4538-b4da-ab09c61fd782"><ac:plain-text-body><![CDATA[ | [[API 2006AA. References#API 06] ] |
| |
[CDATA[ [[Sun 2006AA. References#Sun 06]] | Serialization Specification | ]]></ac:plain-text-body></ac:structured-macro> | <ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="5834a2b3-fccb-4ad3-9aed-06dc1507dced"><ac:plain-text-body><![CDATA[ |
[[Ware 2008AA. References#Ware 08]] | ]]></ac:plain-text-body></ac:structured-macro> |
...
13. Serialization (SER) SER02-J. Sign then seal sensitive objects before sending them outside a trust boundary