Introduction to Object Serialization


Java object serialization is used to persist Java objects to a file,
database, network, process or any other system.
 Serialization flattens objects into an ordered, or serialized stream of bytes.
 The ordered stream of bytes can then be read at a later time,
or in another environment, to recreate the original objects.

Java serialization does not cannot occur for transient or static fields.
 Marking the field transient prevents the state from being written to the stream and from being restored during deserialization.
Java provides classes to support writing objects to streams and restoring objects from streams.
 Only objects that support the java.io.Serializable interface or the java.io.
Externalizable interface can be written to streams.
public interface Serializable
The Serializable interface has no methods or fields. (Marker Interface)
Only objects of classes that implement java.io.Serializable interface can be serialized or deserialized

Comments

Popular Posts