Package org.cryptacular.codec
Interface Encoder
- All Known Implementing Classes:
AbstractBaseNEncoder
,Base32Encoder
,Base64Encoder
,HexEncoder
public interface Encoder
Describes a potentially stateful byte-to-character encoder.
- Author:
- Middleware Services
-
Method Summary
Modifier and TypeMethodDescriptionvoid
encode
(ByteBuffer input, CharBuffer output) Encodes bytes in input buffer into characters placed in the output buffer.void
finalize
(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.
-
Method Details
-
encode
Encodes bytes in input buffer into characters placed in the output buffer. This method may be called multiple times, followed byfinalize(java.nio.CharBuffer)
after all input bytes have been provided.- Parameters:
input
- Input byte buffer.output
- Output character buffer.- Throws:
EncodingException
- on encoding errors.
-
finalize
Performs final output encoding (e.g. padding) after all input bytes have been provided.- Parameters:
output
- Output character buffer.- Throws:
EncodingException
- on encoding errors.
-
outputSize
int outputSize(int inputSize) Expected number of characters in the output buffer for an input buffer of the given size.- Parameters:
inputSize
- Size of input buffer in bytes.- Returns:
- Minimum character buffer size required to store all encoded input bytes.
-