Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Inherited Fields](https://developer.android.com/reference/java/util/zip/CheckedOutputStream#inhfields) \| [Ctors](https://developer.android.com/reference/java/util/zip/CheckedOutputStream#pubctors) \| [Methods](https://developer.android.com/reference/java/util/zip/CheckedOutputStream#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/java/util/zip/CheckedOutputStream#inhmethods)

# CheckedOutputStream


`
public


class
CheckedOutputStream
`


`


`

`


`

`

extends https://developer.android.com/reference/java/io/FilterOutputStream


`

`


`

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||||
| ↳ | [java.io.OutputStream](https://developer.android.com/reference/java/io/OutputStream) |||
|   | ↳ | [java.io.FilterOutputStream](https://developer.android.com/reference/java/io/FilterOutputStream) ||
|   |   | ↳ | java.util.zip.CheckedOutputStream |

<br />

*** ** * ** ***

An output stream that also maintains a checksum of the data being
written. The checksum can then be used to verify the integrity of
the output data.
**See also:**

- `https://developer.android.com/reference/java/util/zip/Checksum`

## Summary

| ### Inherited fields |
|---|
| From class `https://developer.android.com/reference/java/io/FilterOutputStream` |---|---| | ` protected https://developer.android.com/reference/java/io/OutputStream` | `https://developer.android.com/reference/java/io/FilterOutputStream#out` The underlying output stream to be filtered. | |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/java/util/zip/CheckedOutputStream#CheckedOutputStream(java.io.OutputStream,%20java.util.zip.Checksum)(https://developer.android.com/reference/java/io/OutputStream out, https://developer.android.com/reference/java/util/zip/Checksum cksum) ` Creates an output stream with the specified Checksum. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/java/util/zip/Checksum` | ` https://developer.android.com/reference/java/util/zip/CheckedOutputStream#getChecksum()() ` Returns the Checksum for this output stream. |
| ` void` | ` https://developer.android.com/reference/java/util/zip/CheckedOutputStream#write(byte[],%20int,%20int)(byte[] b, int off, int len) ` Writes an array of bytes. |
| ` void` | ` https://developer.android.com/reference/java/util/zip/CheckedOutputStream#write(int)(int b) ` Writes a byte. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/io/FilterOutputStream ` |---|---| | ` void` | ` https://developer.android.com/reference/java/io/FilterOutputStream#close()() ` Closes this output stream and releases any system resources associated with the stream. | | ` void` | ` https://developer.android.com/reference/java/io/FilterOutputStream#flush()() ` Flushes this output stream and forces any buffered output bytes to be written out to the stream. | | ` void` | ` https://developer.android.com/reference/java/io/FilterOutputStream#write(byte[])(byte[] b) ` Writes `b.length` bytes to this output stream. | | ` void` | ` https://developer.android.com/reference/java/io/FilterOutputStream#write(byte[],%20int,%20int)(byte[] b, int off, int len) ` Writes `len` bytes from the specified `byte` array starting at offset `off` to this output stream. | | ` void` | ` https://developer.android.com/reference/java/io/FilterOutputStream#write(int)(int b) ` Writes the specified `byte` to this output stream. | ||
| From class ` https://developer.android.com/reference/java/io/OutputStream ` |---|---| | ` void` | ` https://developer.android.com/reference/java/io/OutputStream#close()() ` Closes this output stream and releases any system resources associated with this stream. | | ` void` | ` https://developer.android.com/reference/java/io/OutputStream#flush()() ` Flushes this output stream and forces any buffered output bytes to be written out. | | ` static https://developer.android.com/reference/java/io/OutputStream` | ` https://developer.android.com/reference/java/io/OutputStream#nullOutputStream()() ` Returns a new `OutputStream` which discards all bytes. | | ` void` | ` https://developer.android.com/reference/java/io/OutputStream#write(byte[])(byte[] b) ` Writes `b.length` bytes from the specified byte array to this output stream. | | ` void` | ` https://developer.android.com/reference/java/io/OutputStream#write(byte[],%20int,%20int)(byte[] b, int off, int len) ` Writes `len` bytes from the specified byte array starting at offset `off` to this output stream. | | ` abstract void` | ` https://developer.android.com/reference/java/io/OutputStream#write(int)(int b) ` Writes the specified byte to this output stream. | ||
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||
| From interface ` https://developer.android.com/reference/java/io/Closeable ` |---|---| | ` abstract void` | ` https://developer.android.com/reference/java/io/Closeable#close()() ` Closes this stream and releases any system resources associated with it. | ||
| From interface ` https://developer.android.com/reference/java/io/Flushable ` |---|---| | ` abstract void` | ` https://developer.android.com/reference/java/io/Flushable#flush()() ` Flushes this stream by writing any buffered output to the underlying stream. | ||
| From interface ` https://developer.android.com/reference/java/lang/AutoCloseable ` |---|---| | ` abstract void` | ` https://developer.android.com/reference/java/lang/AutoCloseable#close()() ` Closes this resource, relinquishing any underlying resources. | ||

## Public constructors

### CheckedOutputStream

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CheckedOutputStream (OutputStream out, 
                Checksum cksum)
```

Creates an output stream with the specified Checksum.

<br />

| Parameters ||
|---|---|
| `out` | `OutputStream`: the output stream <br /> |
| `cksum` | `Checksum`: the checksum <br /> |

## Public methods

### getChecksum

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Checksum getChecksum ()
```

Returns the Checksum for this output stream.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/zip/Checksum` | the Checksum <br /> |

### write

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void write (byte[] b, 
                int off, 
                int len)
```

Writes an array of bytes. Will block until the bytes are
actually written.

<br />

| Parameters ||
|---|---|
| `b` | `byte`: the data to be written <br /> |
| `off` | `int`: the start offset of the data <br /> |
| `len` | `int`: the number of bytes to be written <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/IOException` | if an I/O error has occurred |

### write

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void write (int b)
```

Writes a byte. Will block until the byte is actually written.

<br />

| Parameters ||
|---|---|
| `b` | `int`: the byte to be written <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/IOException` | if an I/O error has occurred |