模块 java.base
 java.io

接口 ObjectOutput

所有父级接口:
AutoCloseable , DataOutput
所有已知的实现类:
ObjectOutputStream

public interface ObjectOutput extends DataOutput , AutoCloseable
ObjectOutput 扩展了 DataOutput 接口以包括对象的写入。 DataOutput 包括用于输出基本类型的方法,ObjectOutput 扩展该接口以包括对象、数组和字符串。
自从:
1.1
参见:
  • 方法详情

    • writeObject

      void writeObject(Object  obj) throws IOException
      将对象写入底层存储或流。实现此接口的类定义了对象的编写方式。
      参数:
      obj - 要写入的对象
      抛出:
      IOException - 任何常见的输入/输出相关异常。
    • write

      void write(int b) throws IOException
      写入一个字节。此方法将阻塞,直到实际写入字节为止。
      指定者:
      write 在接口 DataOutput
      参数:
      b - 字节
      抛出:
      IOException - 如果发生 I/O 错误。
    • write

      void write(byte[] b) throws IOException
      写入一个字节数组。此方法将阻塞,直到实际写入字节为止。
      指定者:
      write 在接口 DataOutput
      参数:
      b - 要写入的数据
      抛出:
      IOException - 如果发生 I/O 错误。
    • write

      void write(byte[] b, int off, int len) throws IOException
      写入一个字节子数组。
      指定者:
      write 在接口 DataOutput
      参数:
      b - 要写入的数据
      off - 数据中的起始偏移量
      len - 写入的字节数
      抛出:
      IOException - 如果发生 I/O 错误。
      IndexOutOfBoundsException - 如果 off 为负,len 为负,或者 len 大于 b.length - off
    • flush

      void flush() throws IOException
      冲洗流。这将写入任何缓冲的输出字节。
      抛出:
      IOException - 如果发生 I/O 错误。
    • close

      void close() throws IOException
      关闭流。必须调用此方法来释放与流关联的任何资源。
      指定者:
      close 在接口 AutoCloseable
      抛出:
      IOException - 如果发生 I/O 错误。