Official documents: https://docs.oracle.com/javase/tutorial/jndi/objects/serial.html
Excellent blog:
Http://www.cnblogs.com/gw811/archive/2012/10/10/2718331.html
Http://www.cnblogs.com/vicenteforever/articles/1471775.html
Interface code:
1 Package java.io; 2 3 Public Interface Serializable {4 }
Concept: Serialization is the conversion of an object into a byte stream, and it can also be converted from a byte stream into a copy of the original object.
Note: after an object is serialized, all its child class objects are also automatically serialized.
When a class declares that it is implementing the Serializable interface, it simply indicates that the class participates in the serialization protocol and does not need to implement any special methods.
To serialize an object, you must first create a outputstream and then insert it into the objectoutputstream. At this point, the object can be written to OutputStream using the WriteObject () method.
The WriteObject () method is responsible for writing the state of an object of a particular class so that the corresponding ReadObject () method can restore it. By calling Out.defaultwriteobject, you can invoke the default mechanism of the field that holds the Object. The method itself does not need to involve states that belong to its superclass or subclass. The state is saved by writing the fields to ObjectOutputStream by using the WriteObject method or by using DataOutput supported methods for the base data type.
Serialization of Java objects (serialization object)