Ask the Expert

What is the purpose of serialization/deserialization in Java?

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?

    Requires Free Membership to View

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

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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: