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 Type
    Method
    Description
    void
    encode(ByteBuffer input, CharBuffer output)
    Encodes bytes in input buffer into characters placed in the output buffer.
    void
    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

      void encode(ByteBuffer input, CharBuffer output) throws EncodingException
      Encodes bytes in input buffer into characters placed in the output buffer. This method may be called multiple times, followed by finalize(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

      void finalize(CharBuffer output) throws EncodingException
      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.