Class AbstractDescribedListTypeEncoder<V>
- java.lang.Object
-
- org.apache.qpid.protonj2.codec.encoders.AbstractDescribedTypeEncoder<V>
-
- org.apache.qpid.protonj2.codec.encoders.AbstractDescribedListTypeEncoder<V>
-
- Type Parameters:
V
- the type that is being encoded
- All Implemented Interfaces:
DescribedTypeEncoder<V>
,TypeEncoder<V>
- Direct Known Subclasses:
AcceptedTypeEncoder
,AttachTypeEncoder
,BeginTypeEncoder
,CloseTypeEncoder
,CoordinatorTypeEncoder
,DeclaredTypeEncoder
,DeclareTypeEncoder
,DeleteOnCloseTypeEncoder
,DeleteOnNoLinksOrMessagesTypeEncoder
,DeleteOnNoLinksTypeEncoder
,DeleteOnNoMessagesTypeEncoder
,DetachTypeEncoder
,DischargeTypeEncoder
,DispositionTypeEncoder
,EndTypeEncoder
,ErrorConditionTypeEncoder
,FlowTypeEncoder
,HeaderTypeEncoder
,ModifiedTypeEncoder
,OpenTypeEncoder
,PropertiesTypeEncoder
,ReceivedTypeEncoder
,RejectedTypeEncoder
,ReleasedTypeEncoder
,SaslChallengeTypeEncoder
,SaslInitTypeEncoder
,SaslMechanismsTypeEncoder
,SaslOutcomeTypeEncoder
,SaslResponseTypeEncoder
,SourceTypeEncoder
,TargetTypeEncoder
,TransactionStateTypeEncoder
,TransferTypeEncoder
public abstract class AbstractDescribedListTypeEncoder<V> extends AbstractDescribedTypeEncoder<V>
Base class used for all Described Type objects that are represented as a List
-
-
Constructor Summary
Constructors Constructor Description AbstractDescribedListTypeEncoder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract int
getElementCount(V value)
Gets the number of elements that will result when this type is encoded into an AMQP List type.byte
getListEncoding(V value)
Determine the list type the given value can be encoded to based on the number of bytes that would be needed to hold the encoded form of the resulting list entries.int
getMinElementCount()
Return the minimum number of elements that this AMQP type must provide in order to be considered a valid type.void
writeArray(ProtonBuffer buffer, EncoderState state, Object[] values)
Write an array elements of the AMQP type to the given byte buffer.abstract void
writeElement(V source, int index, ProtonBuffer buffer, EncoderState state)
Instructs the encoder to write the element identified with the given indexvoid
writeRawArray(ProtonBuffer buffer, EncoderState state, Object[] values)
Write an array elements of the AMQP type to the given byte buffer.void
writeType(ProtonBuffer buffer, EncoderState state, V value)
Write the full AMQP type data to the given byte buffer.-
Methods inherited from class org.apache.qpid.protonj2.codec.encoders.AbstractDescribedTypeEncoder
isArrayType
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.qpid.protonj2.codec.DescribedTypeEncoder
getDescriptorCode, getDescriptorSymbol
-
Methods inherited from interface org.apache.qpid.protonj2.codec.TypeEncoder
getTypeClass
-
-
-
-
Method Detail
-
getListEncoding
public byte getListEncoding(V value)
Determine the list type the given value can be encoded to based on the number of bytes that would be needed to hold the encoded form of the resulting list entries.Most encoders will return LIST32 but for cases where the type is known to be encoded to LIST8 or always encodes an empty list (LIST0) the encoder can optimize the encode step and not compute sizes.
- Parameters:
value
- The value that is to be encoded.- Returns:
- the encoding code of the list type encoding needed for this object.
-
writeElement
public abstract void writeElement(V source, int index, ProtonBuffer buffer, EncoderState state)
Instructs the encoder to write the element identified with the given index- Parameters:
source
- the source of the list elements to writeindex
- the element index that needs to be writtenbuffer
- the buffer to write the element tostate
- the current EncoderState value to use.
-
getElementCount
public abstract int getElementCount(V value)
Gets the number of elements that will result when this type is encoded into an AMQP List type.- Parameters:
value
- the value which will be encoded as a list type.- Returns:
- the number of elements that should comprise the encoded list.
-
getMinElementCount
public int getMinElementCount()
Return the minimum number of elements that this AMQP type must provide in order to be considered a valid type.- Returns:
- the minimum number of elements this type must provide.
-
writeType
public void writeType(ProtonBuffer buffer, EncoderState state, V value)
Description copied from interface:TypeEncoder
Write the full AMQP type data to the given byte buffer.This can consist of writing both a type constructor value and the bytes that make up the value of the type being written.
- Parameters:
buffer
- The buffer to write the AMQP type tostate
- The current encoder statevalue
- The value that is to be written.
-
writeArray
public void writeArray(ProtonBuffer buffer, EncoderState state, Object[] values)
Description copied from interface:TypeEncoder
Write an array elements of the AMQP type to the given byte buffer.This method writes the full Array type definition of an array of the type this encoder manages.
- Parameters:
buffer
- The buffer to write the AMQP array elements tostate
- The current encoder statevalues
- The array of values that is to be written.
-
writeRawArray
public void writeRawArray(ProtonBuffer buffer, EncoderState state, Object[] values)
Description copied from interface:TypeEncoder
Write an array elements of the AMQP type to the given byte buffer.This method writes only the body portion of an AMQP array of this type, the array encoding, size and element count should be assumed to be managed by the caller.
- Parameters:
buffer
- The buffer to write the AMQP array elements tostate
- The current encoder statevalues
- The array of values that is to be written.
-
-