| Modifier and Type | Field and Description |
|---|---|
private boolean |
delimit
Flag indicating whether to delimit every two characters with ':' as in key fingerprints, etc.
|
private static char[] |
ENCODING_TABLE
Hex character encoding table.
|
| Constructor and Description |
|---|
HexEncoder()
Creates a new instance that does not delimit bytes in the output hex string.
|
HexEncoder(boolean delimitBytes)
Creates a new instance with optional delimiting of bytes in the output hex string.
|
| Modifier and Type | Method and Description |
|---|---|
void |
encode(java.nio.ByteBuffer input,
java.nio.CharBuffer output)
Encodes bytes in input buffer into characters placed in the output buffer.
|
void |
finalize(java.nio.CharBuffer output)
Performs final output encoding (e.g.
|
int |
outputSize(int inputSize)
Expected number of characters in the output buffer for an input buffer of the given size.
|
private static final char[] ENCODING_TABLE
private final boolean delimit
public HexEncoder()
public HexEncoder(boolean delimitBytes)
delimitBytes - True to delimit every two characters (i.e. every byte) with ':' character.public void encode(java.nio.ByteBuffer input,
java.nio.CharBuffer output)
throws EncodingException
EncoderEncoder.finalize(java.nio.CharBuffer) after all input bytes have been provided.encode in interface Encoderinput - Input byte buffer.output - Output character buffer.EncodingException - on encoding errors.public void finalize(java.nio.CharBuffer output)
throws EncodingException
Encoderfinalize in interface Encoderoutput - Output character buffer.EncodingException - on encoding errors.public int outputSize(int inputSize)
EncoderoutputSize in interface EncoderinputSize - Size of input buffer in bytes.