Java.io.ObjectInputStream.readClassDescriptor() Method
Description
The java.io.ObjectInputStream.readClassDescriptor() method reads a class descriptor from the serialization stream. This method is called when the ObjectInputStream expects a class descriptor as the next item in the serialization stream. Subclasses of ObjectInputStream may override this method to read in class descriptors that have been written in non-standard formats (by subclasses of ObjectOutputStream which have overridden the writeClassDescriptor method). By default, this method reads class descriptors according to the format defined in the Object Serialization specification.
Declaration
Following is the declaration for java.io.ObjectInputStream.readClassDescriptor() method
protected ObjectStreamClass readClassDescriptor()
Parameters
NA
Return Value
This method returns the class descriptor read
Exception
ClassNotFoundException -- If the Class of a serialized object used in the class descriptor representation cannot be found
IOException -- If an I/O error has occurred.
Example
The following example shows the usage of java.io.ObjectInputStream.readClassDescriptor() method.
Let us compile and run the above program, this will produce the following result: