Java.io.ObjectInputStream.readStreamHeader() Method

Advertisements


Description

The java.io.ObjectInputStream.readStreamHeader() method is provided to allow subclasses to read and verify their own stream headers. It reads and verifies the magic number and version number.

Declaration

Following is the declaration for java.io.ObjectInputStream.readStreamHeader() method

protected void readStreamHeader()

Parameters

  • NA

Return Value

This method does not return a value.

Exception

  • StreamCorruptedException -- if control information in the stream is inconsistent

  • IOException -- if there are I/O errors while reading from the underlying InputStream

Example

The following example shows the usage of java.io.ObjectInputStream.readStreamHeader() method.



Let us compile and run the above program, this will produce the following result:





Advertisements
Advertisements