Reader
as an InputStream
.
This is a stripped down version of org.apache.commons.io.input.ReaderInputStream
of Apache Commons IO 2.7.
Modifier and Type | Field and Description |
---|---|
private static final int | |
private final CharsetEncoder | |
private final CharBuffer | encoderIn
CharBuffer used as input for the decoder. |
private final ByteBuffer | encoderOut
ByteBuffer used as output for the decoder. |
private boolean | |
private static final int | |
private CoderResult | |
private final Reader |
Access | Constructor and Description |
---|---|
public | ReaderInputStream(final Reader
the target reader, final CharsetEncoder Reader the charset encoder encoder)Construct a new |
public | ReaderInputStream(final Reader
the target reader, final CharsetEncoder Reader the charset encoder encoder, final int the size of the input buffer in number of characters bufferSize)Construct a new |
public | ReaderInputStream(Reader
Reader . Must not be null .Construct a |
public | ReaderInputStream(Reader
non-null reader, String Reader .non-null encoding)String encoding.Construct a |
public | ReaderInputStream(Reader
non-null reader, Charset Reader .non-null charset)Charset charset.Construct a |
Modifier and Type | Method and Description |
---|---|
public void | |
private void | |
public int | Returns: the number of bytes read or-1
if the end of the stream has been reachedthe byte array to read into array, int the offset to start reading bytes into off, int the number of bytes to read len)Overrides java. |
public int | Returns: the number of bytes read or-1
if the end of the stream has been reachedthe byte array to read into b)Overrides java. |
public int | Returns: either the byte read or-1 if the end of the stream
has been reachedImplements abstract java. |
DEFAULT_BUFFER_SIZE | back to summary |
---|---|
private static final int DEFAULT_BUFFER_SIZE |
encoder | back to summary |
---|---|
private final CharsetEncoder encoder |
encoderIn | back to summary |
---|---|
private final CharBuffer encoderIn CharBuffer used as input for the decoder. It should be reasonably large as we read data from the underlying Reader into this buffer. |
encoderOut | back to summary |
---|---|
private final ByteBuffer encoderOut ByteBuffer used as output for the decoder. This buffer can be small as it is only used to transfer data from the decoder to the buffer provided by the caller. |
endOfInput | back to summary |
---|---|
private boolean endOfInput |
EOF | back to summary |
---|---|
private static final int EOF |
lastCoderResult | back to summary |
---|---|
private CoderResult lastCoderResult |
reader | back to summary |
---|---|
private final Reader reader |
ReaderInputStream | back to summary |
---|---|
public ReaderInputStream(final Reader reader, final CharsetEncoder encoder) Construct a new
|
ReaderInputStream | back to summary |
---|---|
public ReaderInputStream(final Reader reader, final CharsetEncoder encoder, final int bufferSize) Construct a new
|
ReaderInputStream | back to summary |
---|---|
public ReaderInputStream(Reader reader) Construct a
|
ReaderInputStream | back to summary |
---|---|
public ReaderInputStream(Reader reader, String encoding) Construct a |
ReaderInputStream | back to summary |
---|---|
public ReaderInputStream(Reader reader, Charset charset) Construct a |
close | back to summary |
---|---|
public void close() throws IOException Overrides java. Implements java. Close the stream. This method will cause the underlying
|
fillBuffer | back to summary |
---|---|
private void fillBuffer() throws IOException Fills the internal char buffer from the reader.
|
read | back to summary |
---|---|
public int read(final byte[] array, int off, int len) throws IOException Overrides java. Read the specified number of bytes into an array.
|
read | back to summary |
---|---|
public int read(final byte[] b) throws IOException Overrides java. Read the specified number of bytes into an array.
|
read | back to summary |
---|---|
public int read() throws IOException Implements abstract java. Read a single byte.
|