Class AbstractDescribedMapTypeDecoder<D,K>
- Type Parameters:
D- The described type that this map type implementsK- The key type for the elements in the described type map
- All Implemented Interfaces:
DescribedTypeDecoder<D>,StreamDescribedTypeDecoder<D>,StreamTypeDecoder<D>,TypeDecoder<D>
- Direct Known Subclasses:
ApplicationPropertiesTypeDecoder,DeliveryAnnotationsTypeDecoder,FooterTypeDecoder,MessageAnnotationsTypeDecoder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract DcreateDescribed(Map<K, Object> map) final D[]readArrayElements(InputStream stream, StreamDecoderState state, int count) Reads a series of this type that have been encoded into the body of an Array type.final D[]readArrayElements(ProtonBuffer buffer, DecoderState state, int count) Reads a series of this type that have been encoded into the body of an Array type.protected abstract KreadKey(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 abstract KreadKey(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.final DreadValue(InputStream stream, StreamDecoderState state) Reads the next type from the given buffer and returns it.final DreadValue(ProtonBuffer buffer, DecoderState state) Reads the next type from the given buffer and returns it.protected voidscanMapEntries(InputStream stream, StreamDecoderState state, StreamScanningContext<K> context, BiConsumer<K, Object> matchConsumer) protected voidscanMapEntries(ProtonBuffer buffer, DecoderState state, ScanningContext<K> context, BiConsumer<K, Object> matchConsumer) final voidskipValue(InputStream stream, StreamDecoderState state) Skips over the bytes that compose the type this descriptor decodes.final voidskipValue(ProtonBuffer buffer, DecoderState state) Skips over the bytes that compose the type this descriptor decodes.protected static final intvalidateAndGetCount(int size, InputStream stream, StreamDecoderState state, MapTypeDecoder decoder) protected static final intvalidateAndGetCount(int size, ProtonBuffer buffer, DecoderState state, MapTypeDecoder decoder) Methods 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, getDescriptorCode, getDescriptorSymbolMethods inherited from interface org.apache.qpid.protonj2.codec.StreamDescribedTypeDecoder
getDescriptorCode, getDescriptorSymbolMethods inherited from interface org.apache.qpid.protonj2.codec.StreamTypeDecoder
getTypeClassMethods inherited from interface org.apache.qpid.protonj2.codec.TypeDecoder
getTypeClass
-
Constructor Details
-
AbstractDescribedMapTypeDecoder
public AbstractDescribedMapTypeDecoder()
-
-
Method Details
-
readValue
Description copied from interface:TypeDecoderReads 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.
-
readValue
Description copied from interface:StreamTypeDecoderReads 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.
-
skipValue
Description copied from interface:TypeDecoderSkips over the bytes that compose the type this descriptor decodes.Skipping values can be used when the type is not used or processed by the application doing the decoding. An example might be an AMQP message decoder that only needs to decode certain parts of the message and not others.
- Parameters:
buffer- The buffer that contains the encoded type.state- The decoder state.- Throws:
DecodeException- if an error occurs while skipping the value.
-
skipValue
Description copied from interface:StreamTypeDecoderSkips over the bytes that compose the type this descriptor decodes.Skipping values can be used when the type is not used or processed by the application doing the decoding. An example might be an AMQP message decoder that only needs to decode certain parts of the message and not others.
- Parameters:
stream- The stream that contains the encoded type.state- The decoder state.- Throws:
DecodeException- if an error occurs while skipping the value.
-
readArrayElements
public final D[] readArrayElements(ProtonBuffer buffer, DecoderState state, int count) throws DecodeException Description copied from interface:TypeDecoderReads 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.
-
readArrayElements
public final D[] readArrayElements(InputStream stream, StreamDecoderState state, int count) throws DecodeException Description copied from interface:StreamTypeDecoderReads 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.
-
createDescribed
Called from read method to wrap the decodedMapin the described type wrapper that thisMaptype manages.- Parameters:
map- The decoded map that this type handles.- Returns:
- the described type wrapper around the decoded
Map.
-
readKey
protected abstract K readKey(ProtonBuffer buffer, Decoder decoder, DecoderState state) throws DecodeException 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.- 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 abstract K readKey(InputStream stream, StreamDecoder decoder, StreamDecoderState state) throws DecodeException 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.- 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.
-
scanMapEntries
protected void scanMapEntries(ProtonBuffer buffer, DecoderState state, ScanningContext<K> context, BiConsumer<K, Object> matchConsumer) throws DecodeException- Throws:
DecodeException
-
scanMapEntries
protected void scanMapEntries(InputStream stream, StreamDecoderState state, StreamScanningContext<K> context, BiConsumer<K, Object> matchConsumer) throws DecodeException- Throws:
DecodeException
-
validateAndGetCount
protected static final int validateAndGetCount(int size, ProtonBuffer buffer, DecoderState state, MapTypeDecoder decoder) throws DecodeException - Throws:
DecodeException
-
validateAndGetCount
protected static final int validateAndGetCount(int size, InputStream stream, StreamDecoderState state, MapTypeDecoder decoder) throws DecodeException - Throws:
DecodeException
-