Class FooterTypeDecoder
java.lang.Object
org.apache.qpid.protonj2.codec.decoders.AbstractDescribedTypeDecoder<V>
org.apache.qpid.protonj2.codec.decoders.AbstractDescribedMapTypeDecoder<Footer>
org.apache.qpid.protonj2.codec.decoders.messaging.FooterTypeDecoder
- All Implemented Interfaces:
DescribedTypeDecoder<Footer>
,StreamDescribedTypeDecoder<Footer>
,StreamTypeDecoder<Footer>
,TypeDecoder<Footer>
Decoder of AMQP Footer type values from a byte stream.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ScanningContext<Symbol>
createScanContext
(Collection<Symbol> keys) Creates a new scanning context for the given collection ofSymbol
values.static ScanningContext<Symbol>
createScanContext
(Symbol... keys) Creates a new scanning context for the given collection ofSymbol
values.static StreamScanningContext<Symbol>
Creates a new scanning context for the given collection ofSymbol
values.static StreamScanningContext<Symbol>
createStreamScanContext
(Symbol... keys) Creates a new scanning context for the given collection ofSymbol
values.Returns the AMQP descriptor code for the type this decoder reads.Returns the AMQP descriptor symbol for the type this decoder reads.Footer[]
readArrayElements
(InputStream stream, StreamDecoderState state, int count) Reads a series of this type that have been encoded into the body of an Array type.Footer[]
readArrayElements
(ProtonBuffer buffer, DecoderState state, int count) Reads a series of this type that have been encoded into the body of an Array type.readValue
(InputStream stream, StreamDecoderState state) Reads the next type from the given buffer and returns it.readValue
(ProtonBuffer buffer, DecoderState state) Reads the next type from the given buffer and returns it.void
scanAnnotations
(InputStream stream, StreamDecoderState state, StreamScanningContext<Symbol> context, BiConsumer<Symbol, Object> matchConsumer) Scans through the encodedFooter
map looking for keys that match with the providedScanningContext
.void
scanAnnotations
(ProtonBuffer buffer, DecoderState state, ScanningContext<Symbol> context, BiConsumer<Symbol, Object> matchConsumer) Scans through the encodedFooter
map looking for keys that match with the providedScanningContext
.Methods inherited from class org.apache.qpid.protonj2.codec.decoders.AbstractDescribedMapTypeDecoder
scanMapEntries, scanMapEntries, skipValue, skipValue
Methods inherited from class org.apache.qpid.protonj2.codec.decoders.AbstractDescribedTypeDecoder
checkIsExpectedType, checkIsExpectedType, checkIsExpectedTypeAndCast, checkIsExpectedTypeAndCast, isArrayType, isNull, isPrimitive, readSize, readSize, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.qpid.protonj2.codec.DescribedTypeDecoder
decoderRegistered
-
Constructor Details
-
FooterTypeDecoder
public FooterTypeDecoder()
-
-
Method Details
-
getTypeClass
- Returns:
- the Class that this decoder handles.
-
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
Description copied from interface:DescribedTypeDecoder
Returns the AMQP descriptor symbol for the type this decoder reads.- Returns:
- an symbol descriptor code value.
-
readValue
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 Footer[] 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
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 Footer[] 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
Creates a new scanning context for the given collection ofSymbol
values.- Parameters:
keys
- TheString
keys that will be scanned for in the encodedMap
- Returns:
- a
ScanningContext
for the collection of string keys.
-
createScanContext
Creates a new scanning context for the given collection ofSymbol
values.- Parameters:
keys
- TheString
keys that will be scanned for in the encodedMap
- Returns:
- a
ScanningContext
for the collection of string keys.
-
createStreamScanContext
Creates a new scanning context for the given collection ofSymbol
values.- Parameters:
keys
- TheString
keys that will be scanned for in the encodedMap
- Returns:
- a
ScanningContext
for the collection of Symbol keys.
-
createStreamScanContext
Creates a new scanning context for the given collection ofSymbol
values.- Parameters:
keys
- TheString
keys that will be scanned for in the encodedMap
- 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 DecodeExceptionScans through the encodedFooter
map looking for keys that match with the providedScanningContext
. 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 mappingsstate
- The decoder state used during the scanningcontext
- A matching context primed with the match data needed to match encoded keys.matchConsumer
- ABiConsumer
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 DecodeExceptionScans through the encodedFooter
map looking for keys that match with the providedScanningContext
. 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
- TheInputStream
to scan for specific key / value mappingsstate
- The decoder state used during the scanningcontext
- A matching context primed with the match data needed to match encoded keys.matchConsumer
- ABiConsumer
that will be notified of each matching key / value pair.- Throws:
DecodeException
- if an error is encountered while reading the next value.
-