public abstract class AbstractBaseNDecoder extends java.lang.Object implements Decoder
| Modifier and Type | Field and Description |
|---|---|
private char[] |
block
Block of encoded characters.
|
private int |
blockPos
Current position in character block.
|
private byte[] |
table
Decoding table.
|
| Constructor and Description |
|---|
AbstractBaseNDecoder(byte[] decodingTable)
Creates a new instance with given parameters.
|
| Modifier and Type | Method and Description |
|---|---|
void |
decode(java.nio.CharBuffer input,
java.nio.ByteBuffer output)
Decodes characters in input buffer into bytes placed in the output buffer.
|
void |
finalize(java.nio.ByteBuffer output)
Performs final output decoding (e.g.
|
protected abstract int |
getBitsPerChar() |
protected abstract int |
getBlockLength() |
int |
outputSize(int inputSize)
Expected number of bytes in the output buffer for an input buffer of the given size.
|
private void |
writeOutput(java.nio.ByteBuffer output)
Writes bytes in the current encoding block to the output buffer.
|
private final char[] block
private final byte[] table
private int blockPos
public AbstractBaseNDecoder(byte[] decodingTable)
decodingTable - Byte array indexed by characters in the character set encoding.public void decode(java.nio.CharBuffer input,
java.nio.ByteBuffer output)
throws EncodingException
DecoderDecoder.finalize(ByteBuffer). after all input bytes have been provided.decode in interface Decoderinput - Input character buffer.output - Output byte buffer.EncodingException - on decoding errors.public void finalize(java.nio.ByteBuffer output)
throws EncodingException
Decoderfinalize in interface Decoderoutput - Output byte buffer.EncodingException - on decoding errors.public int outputSize(int inputSize)
DecoderoutputSize in interface DecoderinputSize - Size of input buffer in characters.protected abstract int getBlockLength()
protected abstract int getBitsPerChar()
private void writeOutput(java.nio.ByteBuffer output)
output - Output buffer.