# ObjectOutput

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

|---|---|---|
| Known Indirect Subclasses [ObjectOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectOutputStream.html) |---|---| | [ObjectOutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectOutputStream.html) | An ObjectOutputStream writes primitive data types and graphs of Java objects to an OutputStream. | |||

Defines an interface for classes that allow reading serialized objects.

##### See Also

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

### Public Method Summary

|---|---|
| abstract void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectOutput.html#close())() Closes the target stream. |
| abstract void | [flush](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectOutput.html#flush())() Flushes the target stream. |
| abstract void | [write](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectOutput.html#write(byte[]))(byte\[\] buffer) Writes the entire contents of the byte array `buffer` to the output stream. |
| abstract void | [write](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectOutput.html#write(byte[],%20int,%20int))(byte\[\] buffer, int offset, int count) Writes `count` bytes from the byte array `buffer` starting at position `offset` to the target stream. |
| abstract void | [write](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectOutput.html#write(int))(int value) Writes a single byte to the target stream. |
| abstract void | [writeObject](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/ObjectOutput.html#writeObject(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Writes the specified object `obj` to the target stream. |

### Inherited Method Summary

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

|---|---|
| abstract void | [write](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataOutput.html#write(byte[]))(byte\[\] b) Writes to the output stream all the bytes in array `b`. |
| abstract void | [write](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataOutput.html#write(byte[],%20int,%20int))(byte\[\] b, int off, int len) Writes `len` bytes from array `b`, in order, to the output stream. |
| abstract void | [write](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataOutput.html#write(int))(int b) Writes to the output stream the eight low-order bits of the argument `b`. |
| abstract void | [writeBoolean](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataOutput.html#writeBoolean(boolean))(boolean v) Writes a `boolean` value to this output stream. |
| abstract void | [writeByte](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataOutput.html#writeByte(int))(int v) Writes to the output stream the eight low- order bits of the argument `v`. |
| abstract void | [writeBytes](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataOutput.html#writeBytes(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) s) Writes a string to the output stream. |
| abstract void | [writeChar](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataOutput.html#writeChar(int))(int v) Writes a `char` value, which is comprised of two bytes, to the output stream. |
| abstract void | [writeChars](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataOutput.html#writeChars(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) s) Writes every character in the string `s`, to the output stream, in order, two bytes per character. |
| abstract void | [writeDouble](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataOutput.html#writeDouble(double))(double v) Writes a `double` value, which is comprised of eight bytes, to the output stream. |
| abstract void | [writeFloat](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataOutput.html#writeFloat(float))(float v) Writes a `float` value, which is comprised of four bytes, to the output stream. |
| abstract void | [writeInt](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataOutput.html#writeInt(int))(int v) Writes an `int` value, which is comprised of four bytes, to the output stream. |
| abstract void | [writeLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataOutput.html#writeLong(long))(long v) Writes a `long` value, which is comprised of eight bytes, to the output stream. |
| abstract void | [writeShort](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataOutput.html#writeShort(int))(int v) Writes two bytes to the output stream to represent the value of the argument. |
| abstract void | [writeUTF](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataOutput.html#writeUTF(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) s) Writes two bytes of length information to the output stream, followed by the [modified UTF-8](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/DataInput#modified-utf-8) representation of every character in the string `s`. |

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 void
**close**
()

Closes the target 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 error occurs while closing the target stream. |
|---|---|

#### public abstract void
**flush**
()

Flushes the target stream. Implementations of this method should ensure
that any pending writes are written out to the target stream.

##### Throws

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

#### public abstract void
**write**
(byte\[\] buffer)

Writes the entire contents of the byte array `buffer` to the output
stream. Blocks until all bytes are written.

##### Parameters

| buffer | the buffer to write. |
|---|---|

##### Throws

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

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

Writes `count` bytes from the byte array `buffer` starting at
position `offset` to the target stream. Blocks until all bytes are
written.

##### Parameters

| buffer | the buffer to write. |
| offset | the index of the first byte in `buffer` to write. |
| count | the number of bytes from `buffer` to write to the target stream. |
|---|---|

##### Throws

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

#### public abstract void
**write**
(int value)

Writes a single byte to the target stream. Only the least significant
byte of the integer `value` is written to the stream. Blocks until
the byte is actually written.

##### Parameters

| value | the byte to write. |
|---|---|

##### Throws

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

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

Writes the specified object `obj` to the target stream.

##### Parameters

| obj | the object to write. |
|---|---|

##### Throws

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