1. Why serialization and what is serialization?
For a program, all the objects used exist in the memory. If you want to save the running status of these objects, or you need to transfer objects between different processes or networks, You need to serialize them.
Serialization is to save the running object status in binary or xml format, so that the "virtual" object can be changed to "real ", in this way, they can be stored in the hard disk media or used for network transmission.
An example of a better image is to freeze a living person, which can be called serialization. After a day of technical development, the frozen person can be revived and restored to the state one minute before freezing, that is, deserialization.
Serialization examples used in computers include Web service and sleep of computers.
2. A simple example
In this example, a patient suffers from cancer and can only live to the age of 80 to see how serialization helps him live longer.
Source code: SerializationDemohttp: // www.bkjia.com/uploadfile/2012/0326/20120326113136690.zip
From JustRun1983