Class AcceptedTypeEncoder
java.lang.Object
org.apache.qpid.protonj2.codec.encoders.AbstractDescribedTypeEncoder<V>
org.apache.qpid.protonj2.codec.encoders.AbstractDescribedListTypeEncoder<Accepted>
org.apache.qpid.protonj2.codec.encoders.messaging.AcceptedTypeEncoder
- All Implemented Interfaces:
DescribedTypeEncoder<Accepted>
,TypeEncoder<Accepted>
Encoder of AMQP Accepted type values to a byte stream
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
getElementCount
(Accepted value) Gets the number of elements that will result when this type is encoded into an AMQP List type.byte
getListEncoding
(Accepted 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.void
writeElement
(Accepted source, int index, ProtonBuffer buffer, Encoder encoder, EncoderState state) Instructs the encoder to write the element identified with the given indexvoid
writeType
(ProtonBuffer buffer, EncoderState state, Accepted value) Write the full AMQP type data to the given byte buffer.Methods inherited from class org.apache.qpid.protonj2.codec.encoders.AbstractDescribedListTypeEncoder
getMinElementCount, writeArray, writeRawArray
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
encoderRegistered
-
Constructor Details
-
AcceptedTypeEncoder
public AcceptedTypeEncoder()
-
-
Method Details
-
getTypeClass
- Returns:
- the Class type that this encoder handles.
-
getDescriptorCode
- Returns:
- the UnsignedLong value to use as the Descriptor for this type.
-
getDescriptorSymbol
- Returns:
- the Symbol value to use as the Descriptor for this type.
-
getListEncoding
Description copied from class:AbstractDescribedListTypeEncoder
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.
- Overrides:
getListEncoding
in classAbstractDescribedListTypeEncoder<Accepted>
- Parameters:
value
- The value that is to be encoded.- Returns:
- the encoding code of the list type encoding needed for this object.
-
writeType
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.
- Specified by:
writeType
in interfaceTypeEncoder<Accepted>
- Overrides:
writeType
in classAbstractDescribedListTypeEncoder<Accepted>
- Parameters:
buffer
- The buffer to write the AMQP type tostate
- The current encoder statevalue
- The value that is to be written.
-
writeElement
public void writeElement(Accepted source, int index, ProtonBuffer buffer, Encoder encoder, EncoderState state) Description copied from class:AbstractDescribedListTypeEncoder
Instructs the encoder to write the element identified with the given index- Specified by:
writeElement
in classAbstractDescribedListTypeEncoder<Accepted>
- Parameters:
source
- the source of the list elements to writeindex
- the element index that needs to be writtenbuffer
- the buffer to write the element toencoder
- the current Encoder value to use.state
- the current EncoderState value to use.
-
getElementCount
Description copied from class:AbstractDescribedListTypeEncoder
Gets the number of elements that will result when this type is encoded into an AMQP List type.- Specified by:
getElementCount
in classAbstractDescribedListTypeEncoder<Accepted>
- Parameters:
value
- the value which will be encoded as a list type.- Returns:
- the number of elements that should comprise the encoded list.
-