...
Serialization enables the state of objects in a Java program to be captured and written out to a byte stream [Sun 04b]. This allows for the object state to be preserved so that it can be reinstated in the future (by deserialization). Serialization also allows for Java method calls to be transmitted over a network for Remote Method Invocation (RMI) wherein objects are marshalled (serialized), exchanged between distributed virtual machines, and unmarshalled (deserialized). Serialization is also extensively used in Java Beans.
...
Classes that require special handling during object serialization or deserialization can implement the following methods with exactly the following signatures [API 2006]:
Code Block |
---|
private void writeObject(java.io.ObjectOutputStream out) throws IOException private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException; |
...