Serialization (serialization) is also called serializing, which allows a program to write a complete object into a byte stream. With crossdress (deserialization), you can read a complete object stored in a byte stream.
Serialization can convert Java objects and raw data types into a byte stream appropriate to a network or file system, and Java programmers can easily convert between a Java object and a binary stream without having to deal directly with the raw data stored on the hard disk.
Crossdress is sometimes called parallelization, and parallelization can restore the state of a serialized object, which means that the serialized object is re-instantiated.
Serialization of a Java object must implement the Java.io.Serializable interface or the Java.io.Externalizable interface. The serializable interface is an identity interface, without declaring any method, the Externalizable interface is a sub-interface of the Serializable interface, declares two methods, Writeexternal (ObjectOutput out) and Readexternal (ObjectInput in) method. Writeexternal is called at the time of serialization, Readexternal is called when the crossdress is implemented, the method must implement both methods, so in practice, serializable interface is used more commonly.
Specifically, how to serialize and crossdress a Java object, you can see my other blog post "design mode" Object cloning - prototype mode , this post is mainly to the prototype model mentioned in the serialization of the supplementary description.
Author: Li Li
Sign: Life does not have too many illusions, but to have more action.
"Java" serialization (supplemental prototype mode)