1. Serialization of objects
The process of converting an object to a byte form is object serialization. Serialization also has a name of serialization, the serialized object is then deserialized after the resulting object, and the previous object is no longer the same object.
1) object serialization must implement the Serializable interface, but there is no abstract method for the interface, and no overriding method is required just to label the class serializable.
2) at the same time, it is advisable to add the version number (the number is casually written): Serialversionuid. The version number that matches whether the current class is in the same feature as the object it is deserializing (the property list is consistent, and so on). When deserializing, ObjectInputStream determines whether to deserialize based on the version of the deserialized object that matches the current version. No version number is allowed, but there may be a risk of deserialization failure.
3) Most Java beans provided by the JDK implement the interface
4) Transient keyword: ignores attributes that it modifies when serializing.
5) class used for serialization of objects: ObjectOutputStream
WriteObject (Object obj): ① serializes the given object. ② then writes.
6) The class used by the deserialization of the object: ObjectInputStream
Object ReadObject (): Restores the read sequence of bytes to an object
Case Study:
650) this.width=650; "title=" Clipboard-28.png "src=" http://s3.51cto.com/wyfs02/M02/71/1C/ Wkiom1xfz9tyhdsfaanxrtvuejw190.jpg "alt=" Wkiom1xfz9tyhdsfaanxrtvuejw190.jpg "/>
650) this.width=650; "title=" Clipboard-28-2.png "src=" http://s3.51cto.com/wyfs02/M01/71/19/ Wkiol1xf0els9pekaajxu4oaqgg665.jpg "alt=" Wkiol1xf0els9pekaajxu4oaqgg665.jpg "/>
This article is from "Forever Young" blog, please be sure to keep this source http://kingkongzhao.blog.51cto.com/6319491/1682940
Java Core API--12 (object serialization and deserialization)