Home » Core Java » Serialization & Deserialization in Java

Serialization & Deserialization in Java

 

Serailization :

  1. The process of converting an object from java supported form to file supported or network supported form  and saving state of the object in a file  is called serialization .
  2. The process of  sending an object  as a sequence of bytes that includes the object’s data as well as information about the object’s type and the types of data stored in the object ,across a network line and saving state of the object in a file  is called serialization.
  3. The ObjectOutputStream class is used to serialize an Object.

DeSerailization :

  1. The process of converting an object from file supported or network supported form  to java supported form and reading state of the object from a file  is called deserialization.
  2. The process of  reading an object  as a sequence of bytes that includes the object’s data as well as information about the object’s type and the types of data stored in the object ,across a network line and reading state of the    object from a file  is called deserialization.
  3. The ObjectInputStream class is used to de-serialize an Object.

Both  serialization and  de-serialization  process are JVM independent  i.e. an object can be serialized on one platform and deserialized on an entirely different platform.

Serialization Example :

Download Employee.txt

DeSerialization Example :

 


1 Comment

  1. can you please share one simple example for serialization /deserialization , it will be usefull for beginners.

Leave a comment

Your email address will not be published. Required fields are marked *

four × two =