What is Java Serialization ?




What is Java Serialization ?

  • Serialization is a mechanism to convert an object into stream of bytes so that it can be written into a file, transported through a network or stored into database.
  • De-serialization is just a vice versa. In simple words serialization is converting an object to stream of bytes and de-serialization is rebuilding the object from stream of bytes.
  • Java Serialization API provides the features to perform serialization & de-serialization.
  • A class must implement java.io.Serializable interface to be eligible for serialization.

Advantages of Serialization

  • It is easy to use and can be customized.
  • Serialization is very easy to use and also a serialized stream supports secure Java computing as it can authenticate, encrypt and compress.
  • It supports coherent versioning and also supports flexible to allow the gradual evolution of the program. It can also used to support exchange in libraries between Java and C++.

Disadvantages of Serialization

  • The disadvantages being, it cannot be used with large sized objects.
  • It offers overheads, this in whole delays the process of garbage collection as large objects contain large memory.

Related Searches to What is Java Serialization ?