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

public final class FooterTypeDecoder extends AbstractDescribedMapTypeDecoder<Footer,Symbol>
Decoder of AMQP Footer type values from a byte stream.
  • Field Details

  • Constructor Details

    • FooterTypeDecoder

      public FooterTypeDecoder()
  • Method Details

    • getTypeClass

      public Class<Footer> getTypeClass()
      Description copied from interface: TypeDecoder
      Returns the Class that this decoder handles.
      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.
    • readKey

      protected Symbol readKey(ProtonBuffer buffer, Decoder decoder, DecoderState state) throws DecodeException
      Description copied from class: AbstractDescribedMapTypeDecoder
      Called during decoding of the described Map body to allow the implementation to read the map key using the optimal decoder API for the type of key stored in the map.
      Specified by:
      readKey in class AbstractDescribedMapTypeDecoder<Footer,Symbol>
      Parameters:
      buffer - The buffer where the encoded Map body lives.
      decoder - The Decoder to use for reading the key.
      state - The DecoderState to use while reading the key.
      Returns:
      the newly read Map key.
      Throws:
      DecodeException - if an error occurs while reading the map key.
    • readKey

      protected Symbol readKey(InputStream stream, StreamDecoder decoder, StreamDecoderState state) throws DecodeException
      Description copied from class: AbstractDescribedMapTypeDecoder
      Called during decoding of the described Map body to allow the implementation to read the map key using the optimal decoder API for the type of key stored in the map.
      Specified by:
      readKey in class AbstractDescribedMapTypeDecoder<Footer,Symbol>
      Parameters:
      stream - The bytes stream where the encoded Map body lives.
      decoder - The Decoder to use for reading the key.
      state - The DecoderState to use while reading the key.
      Returns:
      the newly read Map key.
      Throws:
      DecodeException - if an error occurs while reading the map key.
    • createDescribed

      protected Footer createDescribed(Map<Symbol,Object> map)
      Description copied from class: AbstractDescribedMapTypeDecoder
      Called from read method to wrap the decoded Map in the described type wrapper that this Map type manages.
      Specified by:
      createDescribed in class AbstractDescribedMapTypeDecoder<Footer,Symbol>
      Parameters:
      map - The decoded map that this type handles.
      Returns:
      the described type wrapper around the decoded Map.
    • 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 string 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 string 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 ScanningContext 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 ScanningContext 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 Footer 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 Footer 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 Footer 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 Footer 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.