Module org.apache.qpid.protonj2
Class AbstractDescribedTypeDecoder<V>
java.lang.Object
org.apache.qpid.protonj2.codec.decoders.AbstractDescribedTypeDecoder<V>
- Type Parameters:
V- The type that this decoder handles.
- All Implemented Interfaces:
DescribedTypeDecoder<V>,StreamDescribedTypeDecoder<V>,StreamTypeDecoder<V>,TypeDecoder<V>
- Direct Known Subclasses:
AbstractDescribedListTypeDecoder,AbstractDescribedMapTypeDecoder,AmqpSequenceTypeDecoder,AmqpValueTypeDecoder,DataTypeDecoder,UnknownDescribedTypeDecoder
public abstract class AbstractDescribedTypeDecoder<V>
extends Object
implements DescribedTypeDecoder<V>, StreamDescribedTypeDecoder<V>
Abstract base for all Described Type decoders which implements the generic methods
common to all the implementations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static StreamTypeDecoder<?> checkIsExpectedType(Class<?> expected, StreamTypeDecoder<?> actual) protected static TypeDecoder<?> checkIsExpectedType(Class<?> expected, TypeDecoder<?> actual) protected static <E> EcheckIsExpectedTypeAndCast(Class<?> expected, StreamTypeDecoder<?> actual) protected static <E> EcheckIsExpectedTypeAndCast(Class<?> expected, TypeDecoder<?> actual) booleanReturns true if the underlying type that is going to be decoded is an array type.booleanisNull()Returns true if the underlying type is the null type meaning there are no bytes to decode.booleanReturns true if the underlying type that is going to be decoded is an primitive type.intreadSize(InputStream stream, StreamDecoderState state) Reads the size in bytes of the encoded primitive from the givenInputStreamand returns it.intreadSize(ProtonBuffer buffer, DecoderState state) Reads the size in bytes of the encoded AMQP type from the given buffer and returns it.toString()Methods 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
getTypeClass, readArrayElements, readValue, skipValueMethods inherited from interface org.apache.qpid.protonj2.codec.TypeDecoder
getTypeClass, readArrayElements, readValue, skipValue
-
Constructor Details
-
AbstractDescribedTypeDecoder
public AbstractDescribedTypeDecoder()
-
-
Method Details
-
isArrayType
public boolean isArrayType()Description copied from interface:TypeDecoderReturns true if the underlying type that is going to be decoded is an array type.- Specified by:
isArrayTypein interfaceStreamTypeDecoder<V>- Specified by:
isArrayTypein interfaceTypeDecoder<V>- Returns:
- true if the underlying type that is going to be decoded is an array type
-
isNull
public boolean isNull()Description copied from interface:TypeDecoderReturns true if the underlying type is the null type meaning there are no bytes to decode.- Specified by:
isNullin interfaceStreamTypeDecoder<V>- Specified by:
isNullin interfaceTypeDecoder<V>- Returns:
- true if the underlying type is the null type meaning there are no bytes to decode
-
isPrimitive
public boolean isPrimitive()Description copied from interface:TypeDecoderReturns true if the underlying type that is going to be decoded is an primitive type.- Specified by:
isPrimitivein interfaceStreamTypeDecoder<V>- Specified by:
isPrimitivein interfaceTypeDecoder<V>- Returns:
- true if the underlying type that is going to be decoded is an primitive type
-
toString
-
readSize
Description copied from interface:TypeDecoderReads the size in bytes of the encoded AMQP type from the given buffer and returns it. Since this methods advances the read position of the provided buffer the caller must either reset that based on a previous mark or they must read the primitive payload manually as the decoder would not be able to read the value as it has no retained state.- Specified by:
readSizein interfaceTypeDecoder<V>- Parameters:
buffer- the source of encoded data.state- the current state of the decoder.- Returns:
- the size in bytes of the encoded primitive value.
-
readSize
Description copied from interface:StreamTypeDecoderReads the size in bytes of the encoded primitive from the givenInputStreamand returns it. Since this methods advances the read position of the provided stream the caller must either reset that based on a previous mark or they must read the primitive payload manually as the decoder would not be able to read the value as it has no retained state.- Specified by:
readSizein interfaceStreamTypeDecoder<V>- Parameters:
stream- the source of encoded data.state- the current state of the decoder.- Returns:
- the size in bytes of the encoded primitive value.
-
checkIsExpectedTypeAndCast
protected static <E> E checkIsExpectedTypeAndCast(Class<?> expected, TypeDecoder<?> actual) throws DecodeException - Throws:
DecodeException
-
checkIsExpectedTypeAndCast
protected static <E> E checkIsExpectedTypeAndCast(Class<?> expected, StreamTypeDecoder<?> actual) throws DecodeException - Throws:
DecodeException
-
checkIsExpectedType
protected static TypeDecoder<?> checkIsExpectedType(Class<?> expected, TypeDecoder<?> actual) throws DecodeException - Throws:
DecodeException
-
checkIsExpectedType
protected static StreamTypeDecoder<?> checkIsExpectedType(Class<?> expected, StreamTypeDecoder<?> actual) throws DecodeException - Throws:
DecodeException
-