# ObjectInput

public interface **ObjectInput** implements [DataInput](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataInput.html) [AutoCloseable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/AutoCloseable.html)

|---|---|---|
| Known Indirect Subclasses [ObjectInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectInputStream.html) |---|---| | [ObjectInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectInputStream.html) | An ObjectInputStream deserializes primitive data and objects previously written using an ObjectOutputStream. | |||

Defines an interface for classes that allow reading serialized objects.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectInputStream.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectOutput.html`

### Public Method Summary

|---|---|
| abstract int | [available](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectInput.html#available())() Indicates the number of bytes of primitive data that can be read without blocking. |
| abstract void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectInput.html#close())() Closes this stream. |
| abstract int | [read](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectInput.html#read())() Reads a single byte from this stream and returns it as an integer in the range from 0 to 255. |
| abstract int | [read](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectInput.html#read(byte[],%20int,%20int))(byte\[\] buffer, int offset, int count) Reads at most `count` bytes from this stream and stores them in byte array `buffer` starting at offset `count`. |
| abstract int | [read](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectInput.html#read(byte[]))(byte\[\] buffer) Reads bytes from this stream into the byte array `buffer`. |
| abstract [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [readObject](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectInput.html#readObject())() Reads the next object from this stream. |
| abstract long | [skip](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectInput.html#skip(long))(long byteCount) Skips `byteCount` bytes on this stream. |

### Inherited Method Summary

From interface [java.io.DataInput](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataInput.html)

|---|---|
| abstract boolean | [readBoolean](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataInput.html#readBoolean())() Reads one input byte and returns `true` if that byte is nonzero, `false` if that byte is zero. |
| abstract byte | [readByte](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataInput.html#readByte())() Reads and returns one input byte. |
| abstract char | [readChar](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataInput.html#readChar())() Reads two input bytes and returns a `char` value. |
| abstract double | [readDouble](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataInput.html#readDouble())() Reads eight input bytes and returns a `double` value. |
| abstract float | [readFloat](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataInput.html#readFloat())() Reads four input bytes and returns a `float` value. |
| abstract void | [readFully](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataInput.html#readFully(byte[]))(byte\[\] b) Reads some bytes from an input stream and stores them into the buffer array `b`. |
| abstract void | [readFully](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataInput.html#readFully(byte[],%20int,%20int))(byte\[\] b, int off, int len) Reads `len` bytes from an input stream. |
| abstract int | [readInt](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataInput.html#readInt())() Reads four input bytes and returns an `int` value. |
| abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [readLine](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataInput.html#readLine())() Reads the next line of text from the input stream. |
| abstract long | [readLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataInput.html#readLong())() Reads eight input bytes and returns a `long` value. |
| abstract short | [readShort](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataInput.html#readShort())() Reads two input bytes and returns a `short` value. |
| abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [readUTF](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataInput.html#readUTF())() Reads in a string that has been encoded using a [modified UTF-8](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectInput#modified-utf-8) format. |
| abstract int | [readUnsignedByte](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataInput.html#readUnsignedByte())() Reads one input byte, zero-extends it to type `int`, and returns the result, which is therefore in the range `0` through `255`. |
| abstract int | [readUnsignedShort](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataInput.html#readUnsignedShort())() Reads two input bytes and returns an `int` value in the range `0` through `65535`. |
| abstract int | [skipBytes](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataInput.html#skipBytes(int))(int n) Makes an attempt to skip over `n` bytes of data from the input stream, discarding the skipped bytes. |

From interface [java.lang.AutoCloseable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/AutoCloseable.html)

|---|---|
| abstract void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/AutoCloseable.html#close())() Closes this resource, relinquishing any underlying resources. |

## Public Methods

#### public abstract int
**available**
()

Indicates the number of bytes of primitive data that can be read without
blocking.

##### Returns

- the number of bytes available.

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O error occurs. |
|---|---|

#### public abstract void
**close**
()

Closes this stream. Implementations of this method should free any
resources used by the stream.

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O error occurs while closing the input stream. |
|---|---|

#### public abstract int
**read**
()

Reads a single byte from this stream and returns it as an integer in the
range from 0 to 255. Returns -1 if the end of this stream has been
reached. Blocks if no input is available.

##### Returns

- the byte read or -1 if the end of this stream has been reached.

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if this stream is closed or another I/O error occurs. |
|---|---|

#### public abstract int
**read**
(byte\[\] buffer, int offset, int count)

Reads at most `count` bytes from this stream and stores them in
byte array `buffer` starting at offset `count`. Blocks while
waiting for input.

##### Parameters

| buffer | the array in which to store the bytes read. |
| offset | the initial position in `buffer` to store the bytes read from this stream. |
| count | the maximum number of bytes to store in `buffer`. |
|---|---|

##### Returns

- the number of bytes read or -1 if the end of this stream has been reached.

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if this stream is closed or another I/O error occurs. |
|---|---|

#### public abstract int
**read**
(byte\[\] buffer)

Reads bytes from this stream into the byte array `buffer`. Blocks
while waiting for input.

##### Parameters

| buffer | the array in which to store the bytes read. |
|---|---|

##### Returns

- the number of bytes read or -1 if the end of this stream has been reached.

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if this stream is closed or another I/O error occurs. |
|---|---|

#### public abstract [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)
**readObject**
()

Reads the next object from this stream.

##### Returns

- the object read.

##### Throws

| [ClassNotFoundException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/ClassNotFoundException.html) | if the object's class cannot be found. |
| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if this stream is closed or another I/O error occurs. |
|---|---|

#### public abstract long
**skip**
(long byteCount)

Skips `byteCount` bytes on this stream. Less than `byteCount` byte are
skipped if the end of this stream is reached before the operation
completes.

##### Parameters

| byteCount |   |
|---|---|

##### Returns

- the number of bytes actually skipped.

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if this stream is closed or another I/O error occurs. |
|---|---|