Interface Decoder

All Known Implementing Classes:
AbstractBaseNDecoder, Base32Decoder, Base64Decoder, HexDecoder

public interface Decoder
Describes a potentially stateful character-to-byte decoder.
Author:
Middleware Services
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    decode(CharBuffer input, ByteBuffer output)
    Decodes characters in input buffer into bytes placed in the output buffer.
    void
    Performs final output decoding (e.g.
    int
    outputSize(int inputSize)
    Expected number of bytes in the output buffer for an input buffer of the given size.
  • Method Details

    • decode

      void decode(CharBuffer input, ByteBuffer output) throws EncodingException
      Decodes characters in input buffer into bytes placed in the output buffer. This method may be called multiple times, followed by finalize(ByteBuffer). after all input bytes have been provided.
      Parameters:
      input - Input character buffer.
      output - Output byte buffer.
      Throws:
      EncodingException - on decoding errors.
    • finalize

      void finalize(ByteBuffer output) throws EncodingException
      Performs final output decoding (e.g. padding) after all input characters have been provided.
      Parameters:
      output - Output byte buffer.
      Throws:
      EncodingException - on decoding errors.
    • outputSize

      int outputSize(int inputSize)
      Expected number of bytes in the output buffer for an input buffer of the given size.
      Parameters:
      inputSize - Size of input buffer in characters.
      Returns:
      Minimum byte buffer size required to store all decoded characters in input buffer.