I am new to Java and have been told that serialization has benefits when using it for my network programs. Could you clarify to me what are the exact purposes of serialization and deserialization, in 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.
Dig Deeper on Microservices pattern, platforms and frameworks
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.