1/37
Looks like no tags are added yet.
Serialization
The process of converting an object's state into a byte stream. This allows the object's data to be saved to a file, stored in a database, or transmitted over a network so that it can be reconstructed later.
Deserialization
The reverse process of serialization. It converts a previously serialized byte stream back into a Java object, restoring its saved state. The object's class must be available to the Java Virtual Machine (JVM).
Byte Stream
A sequence of bytes representing serialized object data. It allows an object's state to be stored or transmitted in binary form.
Object State
The collection of values stored in an object's instance variables at a particular time. Serialization preserves the serializable portions of this state so they can be restored later.
Object Graph
A structure consisting of an object and the other objects connected to it through references. Serialization can convert an entire graph of serializable objects into a byte stream.
Object Persistence
The ability to preserve an object's state beyond the execution of a program. Serialization supports persistence by allowing objects to be saved and restored later.
Network Transmission
The process of transferring serialized objects between systems or Java Virtual Machines. It allows distributed applications to exchange object data through a network.
Java Virtual Machine (JVM)
The runtime environment responsible for executing Java bytecode. During serialization and deserialization, the JVM handles object conversion, reconstruction, and compatibility checks.
Serializable Interface
A Java interface that allows objects of a class to be serialized. A class implements java.io.Serializable to indicate that its instances support Java's standard serialization mechanism.
Marker Interface
An interface that does not declare methods but identifies a class as having a particular capability. Serializable is a marker interface because it tells the JVM that objects of the class can be serialized.
implements Serializable
A Java declaration that marks a class as serializable. For example, class Student implements Serializable indicates that Student objects can participate in Java serialization.
NotSerializableException
An exception thrown when Java attempts to serialize an object that does not support serialization. It may occur when a class does not implement Serializable or when its object graph contains a non-serializable object.
ObjectOutputStream
A Java class used to write objects to an output stream through serialization. It converts objects into byte streams that can be stored or transmitted.
FileOutputStream
A Java class used to write bytes into a file. During serialization, it is commonly combined with ObjectOutputStream to save serialized objects.
writeObject()
A method of ObjectOutputStream that serializes an object and writes its data to an output stream. It is used when saving Java objects.
ObjectInputStream
A Java class used to read serialized objects from an input stream. It reconstructs objects from previously saved byte streams.
FileInputStream
A Java class used to read bytes from a file. During deserialization, it is commonly combined with ObjectInputStream to retrieve stored object data.
readObject()
A method of ObjectInputStream that reads serialized data and reconstructs an object. The method returns an Object reference, which is commonly cast to the expected class type.
Type Casting
The process of treating an object reference as another compatible type. During deserialization, casting is commonly used to convert the result of readObject() into the original class type, such as (Student) in.readObject().
IOException
An exception that indicates a problem during input or output operations. It can occur when reading or writing serialized data, such as when a file cannot be accessed or a stream operation fails.
ClassNotFoundException
An exception that can occur during deserialization when the JVM cannot locate the class required to reconstruct a serialized object.
Serialized File (.ser)
A file commonly used to store serialized Java objects. It contains binary data representing the object's saved state. This extension is a convention, not a requirement.
transient
A Java keyword used to prevent a particular instance field from being included in the default serialization process. It is commonly applied to sensitive or temporary data, such as passwords.
Transient Field
An instance variable declared using the transient keyword. Its value is excluded from default serialization, and when the object is deserialized, the field receives its default value unless another mechanism restores it.
Default Field Values
The values automatically assigned to fields when no explicit value is provided.
serialVersionUID
A unique version identifier associated with a serializable class. The JVM uses it to check whether a serialized object's class version is compatible with the class used during deserialization.
InvalidClassException
An exception that can occur during deserialization when the serialized object's class information is incompatible with the available class. A mismatch in serialVersionUID can cause this exception.
Version Compatibility
The ability to deserialize previously saved objects using a compatible version of their original class. Declaring an explicit serialVersionUID helps manage class version changes, although matching identifiers do not guarantee complete compatibility.
Externalizable
A Java interface that gives programmers greater control over serialization and deserialization. Unlike standard Serializable, it requires the programmer to manually define how object data is written and read.
Manual Serialization
A process where the programmer explicitly determines which values are written and how they are represented. This is accomplished through the Externalizable interface and its required methods.
writeExternal()
A method required by the Externalizable interface. It allows programmers to specify which object fields are written to an output stream and how those values are stored.
readExternal()
A method required by the Externalizable interface. It defines how serialized data is read and used to restore an object's fields.
Public No-Argument Constructor
A constructor that accepts no parameters and is publicly accessible. Classes implementing Externalizable must provide one so Java can create an instance during deserialization.
Static Fields
Variables declared using the static keyword that belong to the class rather than individual objects. Static fields are not included in standard object serialization because serialization preserves instance state rather than class-level state.
Circular Object References
A situation where objects reference one another in a cycle. These relationships can make object graphs complex. Java's standard serialization handles circular references, but custom serialization logic may require special care.
Security Vulnerabilities in Deserialization
Security risks that may arise when applications deserialize data from untrusted sources. Malicious serialized data can potentially trigger unsafe behavior, making untrusted deserialization dangerous.
Input Validation
The process of checking incoming data before processing it. The module emphasizes validating data from untrusted sources to reduce risks associated with deserialization.
Try-With-Resources
A Java statement that automatically closes resources such as file and object streams after use. It helps prevent resource leaks during serialization and deserialization.