Added in API level 1

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 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.

abstract Any!

Read and return an object.

abstract Long
skip(n: Long)

Skips n bytes of input.

Inherited functions

Public methods

available

Added in API level 1
abstract fun available(): Int

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

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

close

Added in API level 1
abstract fun close(): Unit

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

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

read

Added in API level 1
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
java.io.IOException If an I/O error has occurred.

read

Added in API level 1
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
java.io.IOException If an I/O error has occurred.

read

Added in API level 1
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 Int: the start offset of the data
len Int: 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
java.io.IOException If an I/O error has occurred.

readObject

Added in API level 1
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.
java.io.IOException If any of the usual Input/Output related exceptions occur.

skip

Added in API level 1
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
java.io.IOException If an I/O error has occurred.