# Class TestableByteArrayOutputStream (2.1.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.1.0 (latest)](https://docs-0cloud-0google-0com.linkedin.net.nz/java/docs/reference/google-http-client/latest/com.google.api.client.testing.util.TestableByteArrayOutputStream)
- [2.0.3](https://docs-0cloud-0google-0com.linkedin.net.nz/java/docs/reference/google-http-client/2.0.3/com.google.api.client.testing.util.TestableByteArrayOutputStream)
- [1.47.1](https://docs-0cloud-0google-0com.linkedin.net.nz/java/docs/reference/google-http-client/1.47.1/com.google.api.client.testing.util.TestableByteArrayOutputStream)
- [1.46.3](https://docs-0cloud-0google-0com.linkedin.net.nz/java/docs/reference/google-http-client/1.46.3/com.google.api.client.testing.util.TestableByteArrayOutputStream)
- [1.45.3](https://docs-0cloud-0google-0com.linkedin.net.nz/java/docs/reference/google-http-client/1.45.3/com.google.api.client.testing.util.TestableByteArrayOutputStream)
- [1.44.2](https://docs-0cloud-0google-0com.linkedin.net.nz/java/docs/reference/google-http-client/1.44.2/com.google.api.client.testing.util.TestableByteArrayOutputStream)
- [1.43.2](https://docs-0cloud-0google-0com.linkedin.net.nz/java/docs/reference/google-http-client/1.43.2/com.google.api.client.testing.util.TestableByteArrayOutputStream)
- [1.42.3](https://docs-0cloud-0google-0com.linkedin.net.nz/java/docs/reference/google-http-client/1.42.3/com.google.api.client.testing.util.TestableByteArrayOutputStream)
- [1.41.8](https://docs-0cloud-0google-0com.linkedin.net.nz/java/docs/reference/google-http-client/1.41.8/com.google.api.client.testing.util.TestableByteArrayOutputStream)

    public class TestableByteArrayOutputStream extends ByteArrayOutputStream

[Beta](https://docs-0cloud-0google-0com.linkedin.net.nz/java/docs/reference/google-http-client/latest/com.google.api.client.util.Beta)   

Testable extension for a byte array output stream.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> [java.io.OutputStream](https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html) \> [ByteArrayOutputStream](https://docs.oracle.com/javase/8/docs/api/java/io/ByteArrayOutputStream.html) \> TestableByteArrayOutputStream

## Inherited Members

[ByteArrayOutputStream.close()](https://docs.oracle.com/javase/8/docs/api/java/io/ByteArrayOutputStream.html#close--) [ByteArrayOutputStream.reset()](https://docs.oracle.com/javase/8/docs/api/java/io/ByteArrayOutputStream.html#reset--) [ByteArrayOutputStream.size()](https://docs.oracle.com/javase/8/docs/api/java/io/ByteArrayOutputStream.html#size--) [ByteArrayOutputStream.toByteArray()](https://docs.oracle.com/javase/8/docs/api/java/io/ByteArrayOutputStream.html#toByteArray--) [ByteArrayOutputStream.toString()](https://docs.oracle.com/javase/8/docs/api/java/io/ByteArrayOutputStream.html#toString--) [ByteArrayOutputStream.toString(int)](https://docs.oracle.com/javase/8/docs/api/java/io/ByteArrayOutputStream.html#toString-int-) [ByteArrayOutputStream.toString(String)](https://docs.oracle.com/javase/8/docs/api/java/io/ByteArrayOutputStream.html#toString-java.lang.String-) [ByteArrayOutputStream.toString(Charset)](https://docs.oracle.com/javase/8/docs/api/java/io/ByteArrayOutputStream.html#toString-java.nio.charset.Charset-) [ByteArrayOutputStream.write(byte\[\],int,int)](https://docs.oracle.com/javase/8/docs/api/java/io/ByteArrayOutputStream.html#write-byte[]-int-int-) [ByteArrayOutputStream.write(int)](https://docs.oracle.com/javase/8/docs/api/java/io/ByteArrayOutputStream.html#write-int-) [ByteArrayOutputStream.writeBytes(byte\[\])](https://docs.oracle.com/javase/8/docs/api/java/io/ByteArrayOutputStream.html#writeBytes-byte[]-) [ByteArrayOutputStream.writeTo(OutputStream)](https://docs.oracle.com/javase/8/docs/api/java/io/ByteArrayOutputStream.html#writeTo-java.io.OutputStream-) [OutputStream.flush()](https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html#flush--) [OutputStream.nullOutputStream()](https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html#nullOutputStream--) [OutputStream.write(byte\[\])](https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html#write-byte[]-) [Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Constructors

### TestableByteArrayOutputStream()

    public TestableByteArrayOutputStream()

## Methods

### close()

    public void close()

Overriding is supported, but overriding method must call the super implementation.
**Overrides** [ByteArrayOutputStream.close()](https://docs.oracle.com/javase/8/docs/api/java/io/ByteArrayOutputStream.html#close--)

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### getBuffer()

    public final byte[] getBuffer()

Returns the written buffer value as a modifiable byte array.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html[]` |   |

### isClosed()

    public final boolean isClosed()

Returns whether the output stream has been closed.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |