innovationM
← Back to Blogs

Java Application

Serialization and Deserialization

InnovationM Admin 07 Jul 2022 1 min read
Serialization and Deserialization

Core Java Concepts:

Serialization
Serialization is defined as the process of converting an object into a sequence of bytes that can persist in a database or can be sent through streams.

Serialization saves the state of objects for recreation without having to reprocess them on different platforms.

Serialization is useful for storing, Transmitting the state of an object, and also Cloning an object without overriding the clone.

Create an ObjectOutputStream with a FileOutputStream, to store a serialized object in a file.

FileOutputStream is used to write binary data to a file while ObjectOutputStream is used to convert Java Object to a sequence of bytes and write it to an OutputStream.

Concept of Serialize:

File: SerializationClass.java

Output: 

Deserialization

Deserialization is defined as the opposite or reverse process of creating an object from a sequence of bytes.

Create an ObjectInputStream with a FileInputStream, to re-create an object from a file.

FileInputStream is used to read binary data from files while ObjectInputStream is used to read a sequence of bytes from an InputStream and reconstructs Java Object from that data.

Concept of Deserialize:

file:DeserializationClass.java

Output:

About the Author

InnovationM Admin

Contributor at InnovationM.

LinkedIn

Transform Your Ideas with Expert Guidance

icon
15+ Years of Expertise

Delivering high-impact solutions with years of industry experience.

icon
100+ Satisfied Clients

Helping contact industry software experts to achieve their brand goals.

icon
250+ In-House Team Members

A skilled team ready to tackle projects of any scale.

Book a consultation call with our experts today