public abstract class AbstractBaseNDecoder extends Object implements Decoder
Constructor and Description |
---|
AbstractBaseNDecoder(byte[] decodingTable)
Creates a new instance with given parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
decode(CharBuffer input,
ByteBuffer output)
Decodes characters in input buffer into bytes placed in the output buffer.
|
protected static byte[] |
decodingTable(String alphabet,
int n)
Converts the given alphabet into a base-N decoding table.
|
void |
finalize(ByteBuffer output)
Performs final output decoding (e.g. padding) after all input characters have been provided.
|
protected abstract int |
getBitsPerChar() |
protected abstract int |
getBlockLength() |
boolean |
isPaddedInput() |
int |
outputSize(int inputSize)
Expected number of bytes in the output buffer for an input buffer of the given size.
|
void |
setPaddedInput(boolean enabled)
Determines whether padded input is accepted.
|
public AbstractBaseNDecoder(byte[] decodingTable)
decodingTable
- Byte array indexed by characters in the character set encoding.public boolean isPaddedInput()
public void setPaddedInput(boolean enabled)
enabled
- True to enable support for padded input, false otherwise.public void decode(CharBuffer input, ByteBuffer output) throws EncodingException
Decoder
Decoder.finalize(ByteBuffer)
. after all input bytes have been provided.decode
in interface Decoder
input
- Input character buffer.output
- Output byte buffer.EncodingException
- on decoding errors.public void finalize(ByteBuffer output) throws EncodingException
Decoder
finalize
in interface Decoder
output
- Output byte buffer.EncodingException
- on decoding errors.public int outputSize(int inputSize)
Decoder
outputSize
in interface Decoder
inputSize
- Size of input buffer in characters.protected abstract int getBlockLength()
protected abstract int getBitsPerChar()
protected static byte[] decodingTable(String alphabet, int n)
alphabet
- Decoding alphabet to use.n
- Encoding base.Copyright © 2003-2024 Virginia Tech. All Rights Reserved.