public class CharDecoderInputStream extends InputStream
Reads raw bytes from encoded characters.
Counter-part to CharEncoderReader
.
This is a pull-interface; CharDecoderWriter
is the equivalent push-interface.
Can be adapted to read characters to the consumer (instead of raw bytes)
by wrapping in a InputStreamReader
.
This is only valid if the decoded form of the data is known to only
contain valid characters.
Can also be adapted to read bytes from a provider (instead of characters)
by using a InputStreamReader
as the Reader
.
Modifier and Type | Field and Description |
---|---|
protected ICharToByteDecoder |
decoder |
protected CharBuffer |
readBuffer |
protected Reader |
reader |
protected CodingStates |
state |
protected ByteBuffer |
writeBuffer |
Constructor and Description |
---|
CharDecoderInputStream(ICharToByteDecoder decoder,
Reader reader) |
CharDecoderInputStream(ICharToByteDecoder decoder,
Reader reader,
int readBufferSize) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected boolean |
fillBuffer() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
available, mark, markSupported, read, reset, skip
protected ICharToByteDecoder decoder
protected Reader reader
protected CharBuffer readBuffer
protected ByteBuffer writeBuffer
protected CodingStates state
public CharDecoderInputStream(ICharToByteDecoder decoder, Reader reader)
public CharDecoderInputStream(ICharToByteDecoder decoder, Reader reader, int readBufferSize)
protected boolean fillBuffer() throws IOException
IOException
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
Copyright © 2009–2017 Mark A. Ziesemer. All rights reserved.