Module org.apache.qpid.protonj2
Class AbstractPrimitiveTypeDecoder<V>
java.lang.Object
org.apache.qpid.protonj2.codec.decoders.AbstractPrimitiveTypeDecoder<V>
- Type Parameters:
V- The type that this primitive decoder handles.
- All Implemented Interfaces:
PrimitiveTypeDecoder<V>,StreamTypeDecoder<V>,TypeDecoder<V>
- Direct Known Subclasses:
AbstractArrayTypeDecoder,AbstractBinaryTypeDecoder,AbstractListTypeDecoder,AbstractMapTypeDecoder,AbstractStringTypeDecoder,AbstractSymbolTypeDecoder,BooleanTypeDecoder,ByteTypeDecoder,CharacterTypeDecoder,Decimal128TypeDecoder,Decimal32TypeDecoder,Decimal64TypeDecoder,DoubleTypeDecoder,FloatTypeDecoder,Integer32TypeDecoder,Integer8TypeDecoder,List0TypeDecoder,Long8TypeDecoder,LongTypeDecoder,NullTypeDecoder,ShortTypeDecoder,TimestampTypeDecoder,UnsignedByteTypeDecoder,UnsignedInteger0TypeDecoder,UnsignedInteger32TypeDecoder,UnsignedInteger8TypeDecoder,UnsignedLong0TypeDecoder,UnsignedLong64TypeDecoder,UnsignedLong8TypeDecoder,UnsignedShortTypeDecoder,UUIDTypeDecoder
public abstract class AbstractPrimitiveTypeDecoder<V>
extends Object
implements PrimitiveTypeDecoder<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 TypeMethodDescriptionbooleanReturns true if the underlying type that is going to be decoded is an array type.booleanReturns true if the type managed by this decoder is assignable to a Java primitive type.booleanisNull()Returns true if the underlying type is the null type meaning there are no bytes to decode.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.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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.qpid.protonj2.codec.decoders.PrimitiveTypeDecoder
getTypeCode, isPrimitive, isZeroWidth, readPrimitiveArray, readPrimitiveArrayMethods inherited from interface org.apache.qpid.protonj2.codec.StreamTypeDecoder
getTypeClass, readSize, readValue, skipValueMethods inherited from interface org.apache.qpid.protonj2.codec.TypeDecoder
getTypeClass, readSize, readValue, skipValue
-
Constructor Details
-
AbstractPrimitiveTypeDecoder
public AbstractPrimitiveTypeDecoder()
-
-
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
-
isJavaPrimitive
public boolean isJavaPrimitive()Description copied from interface:PrimitiveTypeDecoderReturns true if the type managed by this decoder is assignable to a Java primitive type.- Specified by:
isJavaPrimitivein interfacePrimitiveTypeDecoder<V>- Returns:
- true if the type managed by this decoder is assignable to a Java primitive type
-
readArrayElements
public 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.
- Specified by:
readArrayElementsin interfaceTypeDecoder<V>- 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 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.
- Specified by:
readArrayElementsin interfaceStreamTypeDecoder<V>- 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.
-