Most visited

Recently visited

Added in API level 1

ObjectInput

public interface ObjectInput
implements DataInput, AutoCloseable

java.io.ObjectInput
Known Indirect Subclasses


ObjectInput扩展了DataInput接口以包含对象的读取。 DataInput包含用于输入基本类型的方法,ObjectInput扩展了该接口以包含对象,数组和字符串。

也可以看看:

Summary

Public methods

abstract int available()

返回可以不阻塞地读取的字节数。

abstract void close()

关闭输入流。

abstract int read()

读取一个字节的数据。

abstract int read(byte[] b, int off, int len)

读入一个字节数组。

abstract int read(byte[] b)

读入一个字节数组。

abstract Object readObject()

读取并返回一个对象。

abstract long skip(long n)

跳过n个字节的输入。

Inherited methods

From interface java.io.DataInput
From interface java.lang.AutoCloseable

Public methods

available

Added in API level 1
int available ()

返回可以不阻塞地读取的字节数。

Returns
int the number of available bytes.
Throws
IOException If an I/O error has occurred.

close

Added in API level 1
void close ()

关闭输入流。 必须调用才能释放与流关联的所有资源。

Throws
IOException If an I/O error has occurred.

read

Added in API level 1
int read ()

读取一个字节的数据。 如果没有可用输入,此方法将被阻止。

Returns
int the byte read, or -1 if the end of the stream is reached.
Throws
IOException If an I/O error has occurred.

read

Added in API level 1
int read (byte[] b, 
                int off, 
                int len)

读入一个字节数组。 此方法将阻止,直到有些输入可用。

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 actual number of bytes read, -1 is returned when the end of the stream is reached.
Throws
IOException If an I/O error has occurred.

read

Added in API level 1
int read (byte[] b)

读入一个字节数组。 此方法将阻止,直到有些输入可用。

Parameters
b byte: the buffer into which the data is read
Returns
int the actual number of bytes read, -1 is returned when the end of the stream is reached.
Throws
IOException If an I/O error has occurred.

readObject

Added in API level 1
Object readObject ()

读取并返回一个对象。 实现此接口的类定义对象从何处“读取”。

Returns
Object the object read from the stream
Throws
ClassNotFoundException If the class of a serialized object cannot be found.
IOException If any of the usual Input/Output related exceptions occur.

skip

Added in API level 1
long skip (long n)

跳过n个字节的输入。

Parameters
n long: the number of bytes to be skipped
Returns
long the actual number of bytes skipped.
Throws
IOException If an I/O error has occurred.

Hooray!