org.restlet.engine.http.io

## Class ChunkedOutputStream

- java.lang.Object
- - java.io.OutputStream
  - - org.restlet.engine.http.io.ChunkedOutputStream

All Implemented Interfaces:
  java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    public class ChunkedOutputStream
    extends java.io.OutputStream

OutputStream to write data in the HTTP chunked encoding format to a destination OutputStream. See section 3.6.1 of HTTP Protocol for more information on chunked encoding.

Author:
  Kevin Conaway
See Also:
  HTTP/1.1 Protocol

### Constructor Summary

Constructors
Constructor and Description
`ChunkedOutputStream(java.io.OutputStream destination)` Convenience constructor to use a default chunk size size of 2048.
`ChunkedOutputStream(java.io.OutputStream destination, int chunkSize)`

### Method Summary

Methods
`void` `close()` Closes this output stream for writing but does not close the wrapped stream.
`void` `flush()` Writes the current chunk and flushes the wrapped stream.
`void` `write(int b)`

### Methods inherited from class java.io.OutputStream

`write, write`

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

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

### Constructor Detail

#### ChunkedOutputStream

    public ChunkedOutputStream(java.io.OutputStream destination)

Convenience constructor to use a default chunk size size of 2048.

Parameters:
  `destination` -
See Also:
  `ChunkedOutputStream(OutputStream, int)`

#### ChunkedOutputStream

    public ChunkedOutputStream(java.io.OutputStream destination,
                       int chunkSize)

Parameters:
  `destination` - Outputstream to write chunked data to
  `chunkSize` - Chunk size

### Method Detail

#### close

    public void close()
               throws java.io.IOException

Closes this output stream for writing but does not close the wrapped stream.

Specified by:
  `close` in interface `java.io.Closeable`
Specified by:
  `close` in interface `java.lang.AutoCloseable`
Overrides:
  `close` in class `java.io.OutputStream`
Throws:
  `java.io.IOException`

#### flush

    public void flush()
               throws java.io.IOException

Writes the current chunk and flushes the wrapped stream.

Specified by:
  `flush` in interface `java.io.Flushable`
Overrides:
  `flush` in class `java.io.OutputStream`
Throws:
  `java.io.IOException`

#### write

    public void write(int b)
               throws java.io.IOException

Specified by:
  `write` in class `java.io.OutputStream`
Throws:
  `java.io.IOException`