During serialization in Java, associated field objects must be serializable.
In Java, a serialized object may be written to a file and read using FileOutputStream
and FileInputStream
.
In Java, implementing the writeObject()
and readObject()
will define a customized way of serializing and deserializing an object.
Serialization is the process of converting an object’s state into a stream of bytes.
In Java, a class implementing Serializable
needs a serialVersionUID
to confirm class compatibility during deserialization.
A class (or any of its parent classes) must implement the Serialiazable
interface (or any of its children interfaces) in order to be serializable.
Deserialization is the process of converting a stream of bytes, created after serialization, back into an object.
Serialization is beneficial when an object needs to be stored or sent over a network.
In Java, any field not marked as static
or transient
is serializable.