public interface ObjectOutput
implements DataOutput, AutoCloseable
| java.io.ObjectOutput |
| |
ObjectOutput扩展了DataOutput接口以包含对象的写入。 DataOutput包括用于输出基本类型的方法,ObjectOutput扩展了该接口以包含对象,数组和字符串。
公共方法(Public methods) |
|
|---|---|
abstract void |
close() 关闭流。 |
abstract void |
flush() 刷新流。 |
abstract void |
write(byte[] b) 写入一个字节数组。 |
abstract void |
write(byte[] b, int off, int len) 写入一个字节的子数组。 |
abstract void |
write(int b) 写一个字节。 |
abstract void |
writeObject(Object obj) 将对象写入底层存储或流。 |
继承方法(Inherited methods) |
|
|---|---|
java.io.DataOutput
|
|
java.lang.AutoCloseable
|
|
void close ()
关闭流。 必须调用此方法才能释放与流关联的所有资源。
| 抛出异常(Throws) | |
|---|---|
IOException |
If an I/O error has occurred. |
void flush ()
刷新流。 这将写入任何缓冲的输出字节。
| 抛出异常(Throws) | |
|---|---|
IOException |
If an I/O error has occurred. |
void write (byte[] b)
写入一个字节数组。 该方法将阻塞,直到字节被实际写入。
| 参数(Parameters) | |
|---|---|
b |
byte: the data to be written |
| 抛出异常(Throws) | |
|---|---|
IOException |
If an I/O error has occurred. |
void write (byte[] b,
int off,
int len)
写入一个字节的子数组。
| 参数(Parameters) | |
|---|---|
b |
byte: the data to be written |
off |
int: the start offset in the data |
len |
int: the number of bytes that are written |
| 抛出异常(Throws) | |
|---|---|
IOException |
If an I/O error has occurred. |
void write (int b)
写一个字节。 该方法将阻塞,直到字节被实际写入。
| 参数(Parameters) | |
|---|---|
b |
int: the byte |
| 抛出异常(Throws) | |
|---|---|
IOException |
If an I/O error has occurred. |
void writeObject (Object obj)
将对象写入底层存储或流。 实现此接口的类定义了如何写入对象。
| 参数(Parameters) | |
|---|---|
obj |
Object: the object to be written |
| 抛出异常(Throws) | |
|---|---|
IOException |
Any of the usual Input/Output related exceptions. |