Interface BinaryTypeDecoder

All Superinterfaces:
PrimitiveTypeDecoder<Binary>, StreamTypeDecoder<Binary>, TypeDecoder<Binary>
All Known Implementing Classes:
AbstractBinaryTypeDecoder, Binary32TypeDecoder, Binary8TypeDecoder

public interface BinaryTypeDecoder extends PrimitiveTypeDecoder<Binary>
Base for all Binary type value decoders.
  • Method Details

    • getTypeClass

      default Class<Binary> getTypeClass()
      Specified by:
      getTypeClass in interface StreamTypeDecoder<Binary>
      Specified by:
      getTypeClass in interface TypeDecoder<Binary>
      Returns:
      the Class that this decoder handles.
    • readSize

      int readSize(ProtonBuffer buffer) throws DecodeException
      Reads the encoded size value for the encoded binary payload and returns it. The read is destructive and the TypeDecoder read methods cannot be called after this unless the ProtonBuffer is reset via a position marker. This method can be useful when the caller intends to manually read the binary payload from the given ProtonBuffer.
      Parameters:
      buffer - the buffer from which the binary encoded size should be read.
      Returns:
      the size of the binary payload that is encoded in the given ProtonBuffer.
      Throws:
      DecodeException - if an error occurs while reading the binary size.
    • readSize

      int readSize(InputStream stream) throws DecodeException
      Reads the encoded size value for the encoded binary payload and returns it. The read is destructive and the TypeDecoder read methods cannot be called after this unless the InputStream is reset via a position marker. This method can be useful when the caller intends to manually read the binary payload from the given InputStream.
      Parameters:
      stream - the stream from which the binary encoded size should be read.
      Returns:
      the size of the binary payload that is encoded in the given InputStream.
      Throws:
      DecodeException - if an error occurs while reading the binary size.