Class AbstractDescribedListTypeDecoder<V>
- Type Parameters:
V- The type that this decoder handles.
- All Implemented Interfaces:
DescribedTypeDecoder<V>,StreamDescribedTypeDecoder<V>,StreamTypeDecoder<V>,TypeDecoder<V>
- Direct Known Subclasses:
AcceptedTypeDecoder,AttachTypeDecoder,BeginTypeDecoder,CloseTypeDecoder,CoordinatorTypeDecoder,DeclaredTypeDecoder,DeclareTypeDecoder,DeleteOnCloseTypeDecoder,DeleteOnNoLinksOrMessagesTypeDecoder,DeleteOnNoLinksTypeDecoder,DeleteOnNoMessagesTypeDecoder,DetachTypeDecoder,DischargeTypeDecoder,DispositionTypeDecoder,EndTypeDecoder,ErrorConditionTypeDecoder,FlowTypeDecoder,HeaderTypeDecoder,ModifiedTypeDecoder,OpenTypeDecoder,PropertiesTypeDecoder,ReceivedTypeDecoder,RejectedTypeDecoder,ReleasedTypeDecoder,SaslChallengeTypeDecoder,SaslInitTypeDecoder,SaslMechanismsTypeDecoder,SaslOutcomeTypeDecoder,SaslResponseTypeDecoder,SourceTypeDecoder,TargetTypeDecoder,TransactionStateTypeDecoder,TransferTypeDecoder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract intReturns the maximum number of elements that may appear in this list type.protected abstract int(@return the minimum number of elements that must appear in this list type}final V[]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 V[]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 VreadSingle(InputStream stream, StreamDecoderState state, ListTypeDecoder listDecoder) Reads a single instance of the described list type using the provided decoder.protected VreadSingle(ProtonBuffer buffer, DecoderState state, ListTypeDecoder listDecoder) Reads a single instance of the described list type using the provided decoder.protected abstract VreadType(int count, InputStream stream, StreamDecoder decoder, StreamDecoderState state) Reads the actual type from the byte stream with the given number of encoded list elements populatedprotected abstract VreadType(int count, ProtonBuffer buffer, Decoder decoder, DecoderState state) Reads the actual type from the byte stream with the given number of encoded list elements populatedfinal VreadValue(InputStream stream, StreamDecoderState state) Reads the next type from the given buffer and returns it.final VreadValue(ProtonBuffer buffer, DecoderState state) Reads the next type from the given buffer and returns it.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.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
-
AbstractDescribedListTypeDecoder
public AbstractDescribedListTypeDecoder()
-
-
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 V[] 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 V[] 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.
-
getMinListElements
protected abstract int getMinListElements()(@return the minimum number of elements that must appear in this list type} -
getMaxListElements
protected abstract int getMaxListElements()Returns the maximum number of elements that may appear in this list type.- Returns:
- the maximum number of elements that may appear in this list type
-
readSingle
protected V readSingle(ProtonBuffer buffer, DecoderState state, ListTypeDecoder listDecoder) throws DecodeException Reads a single instance of the described list type using the provided decoder. The default implementation performs a series of validation checks on the incoming encoded data and then calls the abstract readListType method which can assume the basic contracts of the encoding are correct and simply read the elements into the final described type object.- Parameters:
buffer- The source of the encoded bytes to read the value from.state- The decoder state that was passed at the start of decoding.listDecoder- The list decoder that indicates the structure of the encoded lists of elements.- Returns:
- a single value that is the described type this decoder reads using the given list decoder.
- Throws:
DecodeException- if an error occurs while performing the decode.
-
readSingle
protected V readSingle(InputStream stream, StreamDecoderState state, ListTypeDecoder listDecoder) throws DecodeException Reads a single instance of the described list type using the provided decoder. The default implementation performs a series of validation checks on the incoming encoded data and then calls the abstract readListType method which can assume the basic contracts of the encoding are correct and simply read the elements into the final described type object.- Parameters:
stream- The source of the encoded bytes to read the value from.state- The decoder state that was passed at the start of decoding.listDecoder- The list decoder that indicates the structure of the encoded lists of elements.- Returns:
- a single value that is the described type this decoder reads using the given list decoder.
- Throws:
DecodeException- if an error occurs while performing the decode.
-
readType
protected abstract V readType(int count, ProtonBuffer buffer, Decoder decoder, DecoderState state) throws DecodeException Reads the actual type from the byte stream with the given number of encoded list elements populated- Parameters:
count- The number of entries encoded into the list body.buffer- The source of the encoded bytes to read the value from.decoder- The list decoder that indicates the structure of the encoded lists of elements.state- The decoder state that was passed at the start of decoding.- Returns:
- a single value that is the described type this decoder reads using the given list decoder.
- Throws:
DecodeException- if an error occurs while performing the decode.
-
readType
protected abstract V readType(int count, InputStream stream, StreamDecoder decoder, StreamDecoderState state) throws DecodeException Reads the actual type from the byte stream with the given number of encoded list elements populated- Parameters:
count- The number of entries encoded into the list body.stream- The source of the encoded bytes to read the value from.decoder- The list decoder that indicates the structure of the encoded lists of elements.state- The decoder state that was passed at the start of decoding.- Returns:
- a single value that is the described type this decoder reads using the given list decoder.
- Throws:
DecodeException- if an error occurs while performing the decode.
-