Package org.xnio.streams

# Class ReaderInputStream

java.lang.Object
java.io.InputStream
org.xnio.streams.ReaderInputStream

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

public final class ReaderInputStream extends InputStream
An input stream which encodes characters into bytes.

## Constructor Summary

Constructors
Constructor
Description
`ReaderInputStream(Reader reader)`
Construct a new instance.
`ReaderInputStream(Reader reader, String charsetName)`
Construct a new instance.
`ReaderInputStream(Reader reader, Charset charset)`
Construct a new instance.
`ReaderInputStream(Reader reader, CharsetEncoder encoder)`
Construct a new instance.
`ReaderInputStream(Reader reader, CharsetEncoder encoder, int bufferSize)`
Construct a new instance.

## Method Summary

Modifier and Type
Method
Description
`int`
`available()`
`void`
`close()`
`int`
`read()`
`int`
`read(byte[] b, int off, int len)`
`long`
`skip(long n)`
`String`
`toString()`
Get a string representation of this object.

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

`mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skipNBytes, transferTo`

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

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

## Constructor Details

### ReaderInputStream

public ReaderInputStream(Reader reader)
Construct a new instance.

Parameters:
  `reader` - the reader to encode from

### ReaderInputStream

public ReaderInputStream(Reader reader, String charsetName) throws UnsupportedEncodingException
Construct a new instance.

Parameters:
  `reader` - the reader to encode from
  `charsetName` - the character set name
Throws:
  `UnsupportedEncodingException` - if the character set is not supported

### ReaderInputStream

public ReaderInputStream(Reader reader, Charset charset)
Construct a new instance.

Parameters:
  `reader` - the reader to encode from
  `charset` - the character set

### ReaderInputStream

public ReaderInputStream(Reader reader, CharsetEncoder encoder)
Construct a new instance.

Parameters:
  `reader` - the reader to encode from
  `encoder` - the character set encoder

### ReaderInputStream

public ReaderInputStream(Reader reader, CharsetEncoder encoder, int bufferSize)
Construct a new instance.

Parameters:
  `reader` - the reader to encode from
  `encoder` - the character set encoder
  `bufferSize` - the buffer size to use

## Method Details

### read

public int read() throws IOException

Specified by:
  `read` in class `InputStream`
Throws:
  `IOException`

### read

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

Overrides:
  `read` in class `InputStream`
Throws:
  `IOException`

### skip

public long skip(long n) throws IOException

Overrides:
  `skip` in class `InputStream`
Throws:
  `IOException`

### available

public int available() throws IOException

Overrides:
  `available` in class `InputStream`
Throws:
  `IOException`

### close

public void close() throws IOException

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

### toString

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

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