Divya Surendran    About    Archive    Feed

What is Java Object Serilization

Supports the transformation of a graph of java objects into a stream of bytes for storage or transmission.

Serialisation - Objects gets transformed into byte stream. Deserialisation - Bytes can be transformed into a graph of java objects.

Serializable Classes

A serializable class can be

By default, non-transient and non-static fields are serialized. Transient fields are fields those have meant to be non-persistent.

Object Output Serialization

Note: Only data is stored in a serialization byte stream. - Code is not serialization

JVM in order to de-serialization of an object needs to identify the objects into the class definition it has access to.

The write object method

Primitive types (int, float, bytes, arrays) can also be serialized.