Package org.xnio.streams

# Class WriterOutputStream

java.lang.Object
java.io.OutputStream
org.xnio.streams.WriterOutputStream

All Implemented Interfaces:
  `Closeable`, `Flushable`, `AutoCloseable`

public final class WriterOutputStream extends OutputStream
An output stream which decodes bytes into a character writer.

## Constructor Summary

Constructors
Constructor
Description
`WriterOutputStream(Writer writer)`
Construct a new instance.
`WriterOutputStream(Writer writer, String charsetName)`
Construct a new instance.
`WriterOutputStream(Writer writer, Charset charset)`
Construct a new instance.
`WriterOutputStream(Writer writer, CharsetDecoder decoder)`
Construct a new instance.
`WriterOutputStream(Writer writer, CharsetDecoder decoder, int bufferSize)`
Construct a new instance.

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
`void`
`flush()`
`String`
`toString()`
Get the string representation of this object.
`void`
`write(byte[] b, int off, int len)`
`void`
`write(int b)`

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

`nullOutputStream, write`

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

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

## Constructor Details

### WriterOutputStream

public WriterOutputStream(Writer writer)
Construct a new instance.

Parameters:
  `writer` - the writer to decode into

### WriterOutputStream

public WriterOutputStream(Writer writer, CharsetDecoder decoder)
Construct a new instance.

Parameters:
  `writer` - the writer to decode into
  `decoder` - the charset decoder to use

### WriterOutputStream

public WriterOutputStream(Writer writer, CharsetDecoder decoder, int bufferSize)
Construct a new instance.

Parameters:
  `writer` - the writer to decode into
  `decoder` - the charset decoder to use
  `bufferSize` - the buffer size to use

### WriterOutputStream

public WriterOutputStream(Writer writer, Charset charset)
Construct a new instance.

Parameters:
  `writer` - the writer to decode into
  `charset` - the character set to use

### WriterOutputStream

public WriterOutputStream(Writer writer, String charsetName) throws UnsupportedEncodingException
Construct a new instance.

Parameters:
  `writer` - the writer to decode into
  `charsetName` - the character set name to use
Throws:
  `UnsupportedEncodingException` - if the character set name is unknown

## Method Details

### write

public void write(int b) throws IOException

Specified by:
  `write` in class `OutputStream`
Throws:
  `IOException`

### write

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

Overrides:
  `write` in class `OutputStream`
Throws:
  `IOException`

### flush

public void flush() throws IOException

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

### close

public void close() throws IOException

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Overrides:
  `close` in class `OutputStream`
Throws:
  `IOException`

### toString

public String toString()
Get the string representation of this object.

Overrides:
  `toString` in class `Object`
Returns:
  the string