"Java" serialization (supplemental prototype mode)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.