org.apache.commons.io.output

## Class ChunkedOutputStream

- java.lang.Object
- - java.io.OutputStream
  - - java.io.FilterOutputStream
    - - org.apache.commons.io.output.ChunkedOutputStream

- All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

      public class ChunkedOutputStream
      extends FilterOutputStream

  OutputStream which breaks larger output blocks into chunks. Native code may need to copy the input array; if the write buffer is very large this can cause OOME.

  To build an instance, see `ChunkedOutputStream.Builder`

  See Also:
    `ChunkedOutputStream.Builder`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ChunkedOutputStream.Builder` Builds a new `UnsynchronizedByteArrayOutputStream`.

  - ### Field Summary

    - ### Fields inherited from class java.io.FilterOutputStream

      `out`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ChunkedOutputStream.Builder` | `builder()` Constructs a new `ChunkedOutputStream.Builder`.
    `(package private) int` | `getChunkSize()`
    `void` | `write(byte[] data, int srcOffset, int length)` Writes the data buffer in chunks to the underlying stream

    - ### Methods inherited from class java.io.FilterOutputStream

      `close, flush, write, write`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### builder

          public static ChunkedOutputStream.Builder builder()

      Constructs a new `ChunkedOutputStream.Builder`.
      Returns:
        a new `ChunkedOutputStream.Builder`.

    - #### getChunkSize

          int getChunkSize()

    - #### write

          public void write(byte[] data,
                            int srcOffset,
                            int length)
                     throws IOException

      Writes the data buffer in chunks to the underlying stream
      Overrides:
        `write` in class `FilterOutputStream`
      Parameters:
        `data` - the data to write
        `srcOffset` - the offset
        `length` - the length of data to write
      Throws:
        `IOException` - if an I/O error occurs.