public class DecodingInputStream
extends java.io.FilterInputStream
Decoder such that consumers obtain raw (decoded) bytes from read operations.| Modifier and Type | Field and Description |
|---|---|
private Decoder |
decoder
Performs decoding.
|
private java.nio.CharBuffer |
input
Holds input bytes as characters.
|
private java.nio.ByteBuffer |
output
Receives decoding result.
|
private java.io.InputStreamReader |
reader
Wraps the input stream to convert bytes to characters.
|
| Constructor and Description |
|---|
DecodingInputStream(java.io.InputStream in,
Decoder d)
Creates a new instance that wraps the given stream and performs decoding using the given encoder component.
|
| Modifier and Type | Method and Description |
|---|---|
static DecodingInputStream |
base64(java.io.InputStream in)
Creates a new instance that decodes base64 input from the given stream.
|
static DecodingInputStream |
hex(java.io.InputStream in)
Creates a new instance that decodes hexadecimal input from the given stream.
|
private void |
prepareInputBuffer(int required)
Prepares the input buffer to receive the given number of bytes.
|
private void |
prepareOutputBuffer()
Prepares the output buffer based on input buffer capacity.
|
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
private final Decoder decoder
private final java.io.InputStreamReader reader
private java.nio.CharBuffer input
private java.nio.ByteBuffer output
public DecodingInputStream(java.io.InputStream in,
Decoder d)
in - Input stream to wrap.d - Decoder that provides on-the-fly decoding.public int read()
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic int read(byte[] b)
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic static DecodingInputStream base64(java.io.InputStream in)
in - Wrapped input stream.public static DecodingInputStream hex(java.io.InputStream in)
in - Wrapped input stream.private void prepareInputBuffer(int required)
required - Number of bytes required.private void prepareOutputBuffer()