Top Description Methods
java.io

public Interface ObjectInput

extends DataInput, AutoCloseable
Known Direct Implementers
java.io.ObjectInputStream

ObjectInput extends the DataInput interface to include the reading of objects. DataInput includes methods for the input of primitive types, ObjectInput extends that interface to include objects, arrays, and Strings.
Since
1.1
See Also
java.io.InputStream, java.io.ObjectOutputStream, java.io.ObjectInputStream

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the number of available bytes.
available
()

Returns the number of bytes that can be read without blocking.

public void
close()

Redeclares java.lang.AutoCloseable.close.

Closes the input stream.

public int

Returns:

the byte read, or -1 if the end of the stream is reached.
read
()

Reads a byte of data.

public int

Returns:

the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
read
(byte[]
the buffer into which the data is read
b
)

Reads into an array of bytes.

public int

Returns:

the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
read
(byte[]
the buffer into which the data is read
b
,
int
the start offset of the data
off
,
int
the maximum number of bytes read
len
)

Reads into an array of bytes.

public Object

Returns:

the object read from the stream
readObject
()

Read and return an object.

public long

Returns:

the actual number of bytes skipped.
skip
(long
the number of bytes to be skipped
n
)

Skips n bytes of input.

Inherited from java.io.DataInput:
readBooleanreadBytereadCharreadDoublereadFloatreadFullyreadFullyreadIntreadLinereadLongreadShortreadUnsignedBytereadUnsignedShortreadUTFskipBytes

Method Detail

availableback to summary
public int available() throws IOException

Returns the number of bytes that can be read without blocking.

Returns:int

the number of available bytes.

Exceptions
IOException:
If an I/O error has occurred.
closeback to summary
public void close() throws IOException

Redeclares java.lang.AutoCloseable.close.

Closes the input stream. Must be called to release any resources associated with the stream.

Exceptions
IOException:
If an I/O error has occurred.
readback to summary
public int read() throws IOException

Reads a byte of data. This method will block if no input is available.

Returns:int

the byte read, or -1 if the end of the stream is reached.

Exceptions
IOException:
If an I/O error has occurred.
readback to summary
public int read(byte[] b) throws IOException

Reads into an array of bytes. This method will block until some input is available.

Parameters
b:byte[]

the buffer into which the data is read

Returns:int

the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.

Exceptions
IOException:
If an I/O error has occurred.
readback to summary
public int read(byte[] b, int off, int len) throws IOException

Reads into an array of bytes. This method will block until some input is available.

Parameters
b:byte[]

the buffer into which the data is read

off:int

the start offset of the data

len:int

the maximum number of bytes read

Returns:int

the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.

Exceptions
IOException:
If an I/O error has occurred.
IndexOutOfBoundsException:
If off is negative, len is negative, or len is greater than b.length - off
readObjectback to summary
public Object readObject() throws ClassNotFoundException, IOException

Read and return an object. The class that implements this interface defines where the object is "read" from.

Returns:Object

the object read from the stream

Exceptions
ClassNotFoundException:
If the class of a serialized object cannot be found.
IOException:
If any of the usual Input/Output related exceptions occur.
skipback to summary
public long skip(long n) throws IOException

Skips n bytes of input.

Parameters
n:long

the number of bytes to be skipped

Returns:long

the actual number of bytes skipped.

Exceptions
IOException:
If an I/O error has occurred.