Understanding the Serialization and Externalization mechanisms in Java

Dsforgood
4 min readMar 23, 2022

Hello readers and developers we welcome you all to this article on serialization and externalization mechanisms in java. Serialization is the mechanism of writing the state of an object into a byte-stream. Externalization is the mechanism of customizing the serialization mechanism. In this article we will go through both mechanisms with fully working practical examples. So without wasting your precious time let us start by firstly understanding serialization mechanism.

What is serialization?

Serialization is the mechanism of converting the java object in to a static stream, by which we can save the state of the object. Deserialization is the reverse mechanism of serialization in which we will convert the serialized byte stream back to java object. Below is the illustration explaining the mechanism.

Serialization

Now let us discuss how to implement serialization in java with coding example

Serialization a practical coding example

In this example we are going to serialize a java object in to a file and then de-serialize it back to…

--

--

Dsforgood

We are a bunch of data science enthusiasts simplifying concepts and ideas in technology for common readers. We believe in using data science for good!