ObjectInput

interface ObjectInput : DataInput, AutoCloseable
java.io.ObjectInput

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.

Summary

Public methods
abstract Long
skip(n: Long)

Skips n bytes of input.

abstract Any!

Read and return an object.

abstract Int

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

abstract Unit

Closes the input stream.

abstract Int

Reads a byte of data.

abstract Int

Reads into an array of bytes.

abstract Int
read(b: ByteArray!, off: Int, len: Int)

Reads into an array of bytes.

Inherited functions

Public methods

skip

abstract fun skip(n: Long): Long

Skips n bytes of input.

Parameters
n Long: the number of bytes to be skipped
Return
Long: the actual number of bytes skipped.
Exceptions
IOException If an I/O error has occurred.

readObject

abstract fun readObject(): Any!

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

Return
Any!: the object read from the stream
Exceptions
java.lang.ClassNotFoundException If the class of a serialized object cannot be found.
IOException If any of the usual Input/Output related exceptions occur.

available

abstract fun available(): Int

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

Return
Int: the number of available bytes.
Exceptions
IOException If an I/O error has occurred.

close

abstract fun close(): Unit

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

Exceptions
Exception if this resource cannot be closed
IOException If an I/O error has occurred.

read

abstract fun read(): Int

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

Return
Int: the byte read, or -1 if the end of the stream is reached.
Exceptions
IOException If an I/O error has occurred.

read

abstract fun read(b: ByteArray!): Int

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

Parameters
b ByteArray!: the buffer into which the data is read
Return
Int: the actual number of bytes read, -1 is returned when the end of the stream is reached.
Exceptions
IOException If an I/O error has occurred.

read

abstract fun read(b: ByteArray!, off: Int, len: Int): Int

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

Parameters
b ByteArray!: the buffer into which the data is read
off ByteArray!: the start offset of the data
len ByteArray!: the maximum number of bytes read
Return
Int: the actual number of bytes read, -1 is returned when the end of the stream is reached.
Exceptions
IOException If an I/O error has occurred.