Module org.apache.qpid.protonj2
Class ApplicationPropertiesTypeDecoder
java.lang.Object
org.apache.qpid.protonj2.codec.decoders.AbstractDescribedTypeDecoder<ApplicationProperties>
org.apache.qpid.protonj2.codec.decoders.AbstractDescribedMapTypeDecoder<ApplicationProperties,String>
org.apache.qpid.protonj2.codec.decoders.messaging.ApplicationPropertiesTypeDecoder
- All Implemented Interfaces:
DescribedTypeDecoder<ApplicationProperties>,StreamDescribedTypeDecoder<ApplicationProperties>,StreamTypeDecoder<ApplicationProperties>,TypeDecoder<ApplicationProperties>
public final class ApplicationPropertiesTypeDecoder
extends AbstractDescribedMapTypeDecoder<ApplicationProperties,String>
Decoder of AMQP ApplicationProperties types from a byte stream
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ApplicationPropertiescreateDescribed(Map<String, Object> map) static ScanningContext<String> createScanContext(String... keys) Creates a new scanning context for the given collection ofStringvalues.static ScanningContext<String> createScanContext(Collection<String> keys) Creates a new scanning context for the given collection ofStringvalues.static StreamScanningContext<String> createStreamScanContext(String... keys) Creates a new scanning context for the given collection ofStringvalues.static StreamScanningContext<String> Creates a new scanning context for the given collection ofStringvalues.Returns the AMQP descriptor code for the type this decoder reads.Returns the AMQP descriptor symbol for the type this decoder reads.Returns the Class that this decoder handles.protected StringreadKey(InputStream stream, StreamDecoder decoder, StreamDecoderState state) Called during decoding of the describedMapbody to allow the implementation to read the map key using the optimal decoder API for the type of key stored in the map.protected StringreadKey(ProtonBuffer buffer, Decoder decoder, DecoderState state) Called during decoding of the describedMapbody to allow the implementation to read the map key using the optimal decoder API for the type of key stored in the map.voidscanProperties(InputStream stream, StreamDecoderState state, StreamScanningContext<String> context, BiConsumer<String, Object> matchConsumer) Scans through the encodedApplicationPropertiesmap looking for keys that match with the providedScanningContext.voidscanProperties(ProtonBuffer buffer, DecoderState state, ScanningContext<String> context, BiConsumer<String, Object> matchConsumer) Scans through the encodedApplicationPropertiesmap looking for keys that match with the providedScanningContext.Methods inherited from class org.apache.qpid.protonj2.codec.decoders.AbstractDescribedMapTypeDecoder
readArrayElements, readArrayElements, readValue, readValue, scanMapEntries, scanMapEntries, skipValue, skipValue, validateAndGetCount, validateAndGetCountMethods inherited from class org.apache.qpid.protonj2.codec.decoders.AbstractDescribedTypeDecoder
checkIsExpectedType, checkIsExpectedType, checkIsExpectedTypeAndCast, checkIsExpectedTypeAndCast, isArrayType, isNull, isPrimitive, readSize, readSize, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.qpid.protonj2.codec.DescribedTypeDecoder
decoderRegistered
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
ApplicationPropertiesTypeDecoder
public ApplicationPropertiesTypeDecoder()
-
-
Method Details
-
getTypeClass
Description copied from interface:TypeDecoderReturns the Class that this decoder handles.- Returns:
- the Class that this decoder handles
-
getDescriptorCode
Description copied from interface:DescribedTypeDecoderReturns the AMQP descriptor code for the type this decoder reads.- Returns:
- an unsigned long descriptor code value.
-
getDescriptorSymbol
Description copied from interface:DescribedTypeDecoderReturns the AMQP descriptor symbol for the type this decoder reads.- Returns:
- an symbol descriptor code value.
-
readKey
protected String readKey(ProtonBuffer buffer, Decoder decoder, DecoderState state) throws DecodeException Description copied from class:AbstractDescribedMapTypeDecoderCalled during decoding of the describedMapbody 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:
readKeyin classAbstractDescribedMapTypeDecoder<ApplicationProperties,String> - Parameters:
buffer- The buffer where the encodedMapbody lives.decoder- TheDecoderto use for reading the key.state- TheDecoderStateto use while reading the key.- Returns:
- the newly read
Mapkey. - Throws:
DecodeException- if an error occurs while reading the map key.
-
readKey
protected String readKey(InputStream stream, StreamDecoder decoder, StreamDecoderState state) throws DecodeException Description copied from class:AbstractDescribedMapTypeDecoderCalled during decoding of the describedMapbody 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:
readKeyin classAbstractDescribedMapTypeDecoder<ApplicationProperties,String> - Parameters:
stream- The bytes stream where the encodedMapbody lives.decoder- TheDecoderto use for reading the key.state- TheDecoderStateto use while reading the key.- Returns:
- the newly read
Mapkey. - Throws:
DecodeException- if an error occurs while reading the map key.
-
createDescribed
Description copied from class:AbstractDescribedMapTypeDecoderCalled from read method to wrap the decodedMapin the described type wrapper that thisMaptype manages.- Specified by:
createDescribedin classAbstractDescribedMapTypeDecoder<ApplicationProperties,String> - Parameters:
map- The decoded map that this type handles.- Returns:
- the described type wrapper around the decoded
Map.
-
createScanContext
Creates a new scanning context for the given collection ofStringvalues.- Parameters:
keys- TheStringkeys that will be scanned for in the encodedMap- Returns:
- a
ScanningContextfor the collection of string keys.
-
createScanContext
Creates a new scanning context for the given collection ofStringvalues.- Parameters:
keys- TheStringkeys that will be scanned for in the encodedMap- Returns:
- a
ScanningContextfor the collection of string keys.
-
createStreamScanContext
Creates a new scanning context for the given collection ofStringvalues.- Parameters:
keys- TheStringkeys that will be scanned for in the encodedMap- Returns:
- a
ScanningContextfor the collection of string keys.
-
createStreamScanContext
Creates a new scanning context for the given collection ofStringvalues.- Parameters:
keys- TheStringkeys that will be scanned for in the encodedMap- Returns:
- a
ScanningContextfor the collection of string keys.
-
scanProperties
public void scanProperties(ProtonBuffer buffer, DecoderState state, ScanningContext<String> context, BiConsumer<String, Object> matchConsumer) throws DecodeExceptionScans through the encodedApplicationPropertiesmap 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 ApplicationProperties 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- ABiConsumerthat will be notified of each matching key / value pair.- Throws:
DecodeException- if an error is encountered while reading the next value.
-
scanProperties
public void scanProperties(InputStream stream, StreamDecoderState state, StreamScanningContext<String> context, BiConsumer<String, Object> matchConsumer) throws DecodeExceptionScans through the encodedApplicationPropertiesmap 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 ApplicationProperties have been read and that decoding of the next object can begin if the provided stream remains readable.- Parameters:
stream- TheInputStreamto 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- ABiConsumerthat will be notified of each matching key / value pair.- Throws:
DecodeException- if an error is encountered while reading the next value.
-