Java.io.ObjectOutputStream.writeStreamHeader() Method

Advertisements


Description

The java.io.ObjectOutputStream.writeStreamHeader() method is provided so subclasses can append or prepend their own header to the stream. It writes the magic number and version to the stream.

Declaration

Following is the declaration for java.io.ObjectOutputStream.writeStreamHeader() method

protected void writeStreamHeader()

Parameters

  • NA

Return Value

This method does not return a value.

Exception

  • IOException -- if I/O errors occur while writing to the underlying stream

Example

The following example shows the usage of java.io.ObjectOutputStream.writeStreamHeader() method.


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





Advertisements
Advertisements