- 所有父级接口:
AutoCloseable
,DataOutput
- 所有已知的实现类:
ObjectOutputStream
ObjectOutput 扩展了 DataOutput 接口以包括对象的写入。 DataOutput 包括用于输出基本类型的方法,ObjectOutput 扩展该接口以包括对象、数组和字符串。
- 自从:
- 1.1
- 参见:
-
方法总结
在接口 java.io.DataOutput 中声明的方法
writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
-
方法详情
-
writeObject
将对象写入底层存储或流。实现此接口的类定义了对象的编写方式。- 参数:
obj
- 要写入的对象- 抛出:
IOException
- 任何常见的输入/输出相关异常。
-
write
写入一个字节。此方法将阻塞,直到实际写入字节为止。- 指定者:
write
在接口DataOutput
中- 参数:
b
- 字节- 抛出:
IOException
- 如果发生 I/O 错误。
-
write
写入一个字节数组。此方法将阻塞,直到实际写入字节为止。- 指定者:
write
在接口DataOutput
中- 参数:
b
- 要写入的数据- 抛出:
IOException
- 如果发生 I/O 错误。
-
write
写入一个字节子数组。- 指定者:
write
在接口DataOutput
中- 参数:
b
- 要写入的数据off
- 数据中的起始偏移量len
- 写入的字节数- 抛出:
IOException
- 如果发生 I/O 错误。IndexOutOfBoundsException
- 如果off
为负,len
为负,或者len
大于b.length - off
-
flush
冲洗流。这将写入任何缓冲的输出字节。- 抛出:
IOException
- 如果发生 I/O 错误。
-
close
关闭流。必须调用此方法来释放与流关联的任何资源。- 指定者:
close
在接口AutoCloseable
中- 抛出:
IOException
- 如果发生 I/O 错误。
-