What is serialization
The serialization (serialization) mechanism in Java can write the state information of an instance object into a byte stream, allowing it to be transmitted through a socket, or persisted to a database or file system, and then, when needed, You can refactor an identical object based on the information in the byte Stream. The serialization mechanism is widely used in java, and the EJB, RMI and other technologies are based on This.
proper use of serialization mechanisms
In general, to make a class serializable, simply implement the Java.io.Serializable interface (
and implement a parameterless construction method ). The interface is a labeled interface that itself does not contain any content, and implementing that interface means that the class is ready to support Serialization. The following example defines a class person and declares that it can be serialized. The above two paragraphs source: http://lionheart.iteye.com/blog/139540 the default format is binary (requires object implementation seralizable interface), can be used as follows: reprinted from: http://blog.csdn.net/ isea533/article/details/7859815
Java serialization and deserialization three format access (default format, XML format, JSON format)