Class DeliveryAnnotationsTypeDecoder

All Implemented Interfaces:
DescribedTypeDecoder<DeliveryAnnotations>, StreamDescribedTypeDecoder<DeliveryAnnotations>, StreamTypeDecoder<DeliveryAnnotations>, TypeDecoder<DeliveryAnnotations>

public final class DeliveryAnnotationsTypeDecoder extends AbstractDescribedMapTypeDecoder<DeliveryAnnotations>
Decoder of AMQP Delivery Annotations type values from a byte stream.
  • Constructor Details

    • DeliveryAnnotationsTypeDecoder

      public DeliveryAnnotationsTypeDecoder()
  • Method Details

    • getTypeClass

      public Class<DeliveryAnnotations> getTypeClass()
      Returns:
      the Class that this decoder handles.
    • getDescriptorCode

      public UnsignedLong getDescriptorCode()
      Description copied from interface: DescribedTypeDecoder
      Returns the AMQP descriptor code for the type this decoder reads.
      Returns:
      an unsigned long descriptor code value.
    • getDescriptorSymbol

      public Symbol getDescriptorSymbol()
      Description copied from interface: DescribedTypeDecoder
      Returns the AMQP descriptor symbol for the type this decoder reads.
      Returns:
      an symbol descriptor code value.
    • readValue

      public DeliveryAnnotations readValue(ProtonBuffer buffer, DecoderState state) throws DecodeException
      Description copied from interface: TypeDecoder
      Reads the next type from the given buffer and returns it.
      Parameters:
      buffer - the source of encoded data.
      state - the current state of the decoder.
      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 DeliveryAnnotations[] 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.

      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.
    • readValue

      public DeliveryAnnotations readValue(InputStream stream, StreamDecoderState state) throws DecodeException
      Description copied from interface: StreamTypeDecoder
      Reads the next type from the given buffer and returns it.
      Parameters:
      stream - the source of encoded data.
      state - the current state of the decoder.
      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 DeliveryAnnotations[] 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.

      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.
    • createScanContext

      public static ScanningContext<Symbol> createScanContext(Symbol... keys)
      Creates a new scanning context for the given collection of Symbol values.
      Parameters:
      keys - The String keys that will be scanned for in the encoded Map
      Returns:
      a ScanningContext for the collection of Symbol keys.
    • createScanContext

      public static ScanningContext<Symbol> createScanContext(Collection<Symbol> keys)
      Creates a new scanning context for the given collection of Symbol values.
      Parameters:
      keys - The String keys that will be scanned for in the encoded Map
      Returns:
      a ScanningContext for the collection of Symbol keys.
    • createStreamScanContext

      public static StreamScanningContext<Symbol> createStreamScanContext(Symbol... keys)
      Creates a new scanning context for the given collection of Symbol values.
      Parameters:
      keys - The String keys that will be scanned for in the encoded Map
      Returns:
      a StreamScanningContext for the collection of Symbol keys.
    • createStreamScanContext

      public static StreamScanningContext<Symbol> createStreamScanContext(Collection<Symbol> keys)
      Creates a new scanning context for the given collection of Symbol values.
      Parameters:
      keys - The String keys that will be scanned for in the encoded Map
      Returns:
      a StreamScanningContext for the collection of Symbol keys.
    • scanAnnotations

      public void scanAnnotations(ProtonBuffer buffer, DecoderState state, ScanningContext<Symbol> context, BiConsumer<Symbol,Object> matchConsumer) throws DecodeException
      Scans through the encoded ApplicationProperties map looking for keys that match with the provided ScanningContext. When a match is found the provided match consumer is called with the matched key and the decoded value mapped to that key. When the method returns the caller can assume that all bytes of the encoded DeliveryAnnotations have been read and that decoding of the next object can begin if the provided buffer remains readable.
      Parameters:
      buffer - The buffer to scan for specific key / value mappings
      state - The decoder state used during the scanning
      context - A matching context primed with the match data needed to match encoded keys.
      matchConsumer - A BiConsumer that will be notified of each matching key / value pair.
      Throws:
      DecodeException - if an error is encountered while reading the next value.
    • scanAnnotations

      public void scanAnnotations(InputStream stream, StreamDecoderState state, StreamScanningContext<Symbol> context, BiConsumer<Symbol,Object> matchConsumer) throws DecodeException
      Scans through the encoded DeliveryAnnotations map looking for keys that match with the provided ScanningContext. When a match is found the provided match consumer is called with the matched key and the decoded value mapped to that key. When the method returns the caller can assume that all bytes of the encoded DeliveryAnnotations have been read and that decoding of the next object can begin if the provided stream remains readable.
      Parameters:
      stream - The InputStream to scan for specific key / value mappings
      state - The decoder state used during the scanning
      context - A matching context primed with the match data needed to match encoded keys.
      matchConsumer - A BiConsumer that will be notified of each matching key / value pair.
      Throws:
      DecodeException - if an error is encountered while reading the next value.