Class AbstractPrimitiveTypeDecoder<V>

java.lang.Object
org.apache.qpid.protonj2.codec.decoders.AbstractPrimitiveTypeDecoder<V>
Type Parameters:
V - The type that this primitive decoder handles.
All Implemented Interfaces:
PrimitiveTypeDecoder<V>, StreamTypeDecoder<V>, TypeDecoder<V>
Direct Known Subclasses:
AbstractArrayTypeDecoder, AbstractBinaryTypeDecoder, AbstractListTypeDecoder, AbstractMapTypeDecoder, AbstractStringTypeDecoder, AbstractSymbolTypeDecoder, BooleanTypeDecoder, ByteTypeDecoder, CharacterTypeDecoder, Decimal128TypeDecoder, Decimal32TypeDecoder, Decimal64TypeDecoder, DoubleTypeDecoder, FloatTypeDecoder, Integer32TypeDecoder, Integer8TypeDecoder, List0TypeDecoder, LongTypeDecoder, NullTypeDecoder, ShortTypeDecoder, TimestampTypeDecoder, UnsignedByteTypeDecoder, UnsignedInteger0TypeDecoder, UnsignedInteger32TypeDecoder, UnsignedInteger8TypeDecoder, UnsignedLong0TypeDecoder, UnsignedLong64TypeDecoder, UnsignedLong8TypeDecoder, UnsignedShortTypeDecoder, UUIDTypeDecoder

public abstract class AbstractPrimitiveTypeDecoder<V> extends Object implements PrimitiveTypeDecoder<V>
Abstract base for all Described Type decoders which implements the generic methods common to all the implementations.
  • Constructor Details

    • AbstractPrimitiveTypeDecoder

      public AbstractPrimitiveTypeDecoder()
  • Method Details

    • isArrayType

      public boolean isArrayType()
      Specified by:
      isArrayType in interface StreamTypeDecoder<V>
      Specified by:
      isArrayType in interface TypeDecoder<V>
      Returns:
      true if the underlying type that is going to be decoded is an array type
    • isJavaPrimitive

      public boolean isJavaPrimitive()
      Specified by:
      isJavaPrimitive in interface PrimitiveTypeDecoder<V>
      Returns:
      true if the type managed by this decoder is assignable to a Java primitive type.
    • readArrayElements

      public V[] readArrayElements(ProtonBuffer buffer, DecoderState state, int count) throws DecodeException
      Description copied from interface: TypeDecoder
      Reads a series of this type that have been encoded into the body of an Array type.

      When encoded into an array the values are encoded in series following the identifier for the type, this method is given a count of the number of instances that are encoded and should read each in succession and returning them in a new array.

      Specified by:
      readArrayElements in interface TypeDecoder<V>
      Parameters:
      buffer - the source of encoded data.
      state - the current state of the decoder.
      count - the number of array elements encoded in the buffer.
      Returns:
      the next instance in the stream that this decoder handles.
      Throws:
      DecodeException - if an error is encountered while reading the next value.
    • readArrayElements

      public V[] readArrayElements(InputStream stream, StreamDecoderState state, int count) throws DecodeException
      Description copied from interface: StreamTypeDecoder
      Reads a series of this type that have been encoded into the body of an Array type.

      When encoded into an array the values are encoded in series following the identifier for the type, this method is given a count of the number of instances that are encoded and should read each in succession and returning them in a new array.

      Specified by:
      readArrayElements in interface StreamTypeDecoder<V>
      Parameters:
      stream - the source of encoded data.
      state - the current state of the decoder.
      count - the number of array elements encoded in the buffer.
      Returns:
      the next instance in the stream that this decoder handles.
      Throws:
      DecodeException - if an error is encountered while reading the next value.