Java serialization and deserialization three format access (default format, XML format, JSON format)

Source: Internet
Author: User
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)

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.