Q

What is the purpose of serialization/deserialization in Java?

This Content Component encountered an error

I am new to Java and have been told that serialization has benefits in using it for my network programs. Could you clarify to me what the exact purpose of serialization and deserialization is as far as using it in my project?

Speaking in the context of the Java programming language, serialization and deserialization communicates Java's ability to "flatten" an object to a data stream and, conversely, reconstruct the object from a data stream.

The primary player in the "serialization" show is the Serializable interface. The Serializable interface is a "marker" interface. This means that it has no methods or fields, but simply "marks" a class as being able to be serialized. When the Java VM encounters a class that is "marked" as Serializable during a serialization process, the VM will assume that it is safe to write to the stream. This all happens somewhat automatically for a developer.

The serialization and deserialization process is used extensively throughout many of the remote communications processes of the Java platform. The Remote Method Invocation (RMI) mechanism of Java is one of the most notable of these processes. When making a method call within the RMI framework, any non-primitive objects are serialized to the underlying data stream and sent to the target remote process where they are deserialized and reconstructed. A number of different Java technologies including Enterprise JavaBeans (EJB) use the RMI framework.

This was first published in January 2003

Dig deeper on Java Web Services

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchSoftwareQuality

SearchCloudApplications

SearchAWS

TheServerSide

SearchWinDevelopment

Close