All exceptions thrown by serialization classes are subclasses of
ObjectStreamException which is a subclass of
Superclass of all serialization exceptions.
Thrown when a class cannot be used to restore objects for any of these reasons:
- The class does not match the serial version of the class in the stream.
- The class contains fields with invalid primitive data types.
Externalizableclass does not have a public no-arg constructor.
Serializableclass can not access the no-arg constructor of its closest non-Serializable superclass.
Thrown by a
writeObject method to terminate serialization or deserialization.
- If the stream header is invalid.
- If control information not found.
- If control information is invalid.
- JDK 1.1.5 or less attempts to call
writeObject state is invalid within the following
readObject state is invalid within the following
Thrown when a restored object cannot be made valid.
readObject when there is primitive data in the stream and an object is expected. The length field of the exception indicates the number of bytes that are available in the current block.
Thrown when reading a stream terminated by an exception that occurred while the stream was being written.