public abstract class AbstractBaseNEncoder extends Object implements Encoder
Modifier and Type | Field and Description |
---|---|
protected int |
lineLength
Number of base64 characters per line.
|
Constructor and Description |
---|
AbstractBaseNEncoder(char[] characterSet,
int charactersPerLine)
Creates a new instance with given parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
encode(ByteBuffer input,
CharBuffer output)
Encodes bytes in input buffer into characters placed in the output buffer.
|
protected static char[] |
encodingTable(String alphabet,
int n)
Converts the given alphabet into a base-N encoding table.
|
void |
finalize(CharBuffer output)
Performs final output encoding (e.g. padding) after all input bytes have been provided.
|
protected abstract int |
getBitsPerChar() |
protected abstract int |
getBlockLength() |
boolean |
isPaddedOutput() |
int |
outputSize(int inputSize)
Expected number of characters in the output buffer for an input buffer of the given size.
|
void |
setPaddedOutput(boolean enabled)
Sets the output padding mode.
|
public AbstractBaseNEncoder(char[] characterSet, int charactersPerLine)
characterSet
- Encoding character set.charactersPerLine
- Number of characters per line.public boolean isPaddedOutput()
public void setPaddedOutput(boolean enabled)
enabled
- True to enable padded output, false otherwise.public void encode(ByteBuffer input, CharBuffer output) throws EncodingException
Encoder
Encoder.finalize(java.nio.CharBuffer)
after all input bytes have been provided.encode
in interface Encoder
input
- Input byte buffer.output
- Output character buffer.EncodingException
- on encoding errors.public void finalize(CharBuffer output) throws EncodingException
Encoder
finalize
in interface Encoder
output
- Output character buffer.EncodingException
- on encoding errors.public int outputSize(int inputSize)
Encoder
outputSize
in interface Encoder
inputSize
- Size of input buffer in bytes.protected abstract int getBlockLength()
protected abstract int getBitsPerChar()
protected static char[] encodingTable(String alphabet, int n)
alphabet
- Encoding alphabet to use.n
- Encoding base.Copyright © 2003-2024 Virginia Tech. All Rights Reserved.