Class ProtonEncoder
java.lang.Object
org.apache.qpid.protonj2.codec.encoders.ProtonEncoder
- All Implemented Interfaces:
Encoder
The default AMQP Encoder implementation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn a singletonEncoderStateinstance that is meant to be shared within single threaded encoder interactions.TypeEncoder<?>getTypeEncoder(Class<?> typeClass) Lookup aTypeEncoderthat would be used to encode the givenClass.TypeEncoder<?>getTypeEncoder(Class<?> typeClass, Object instance) Lookup aTypeEncoderby first checking the given typeClassand then if none found to deduce a valid TypeEncoder from theObjectspecified.TypeEncoder<?>getTypeEncoder(Object value) Lookup aTypeEncoderthat would be used to encode the givenObject.Creates a newEncoderStateinstance that can be used when interacting with the Encoder.<V> ProtonEncoderregisterDescribedTypeEncoder(DescribedTypeEncoder<V> encoder) Register aDescribedTypeEncoderwhich can be used when writing custom types using this encoder.voidwriteArray(ProtonBuffer buffer, EncoderState state, boolean[] value) Write the given array as with the proper array type encoding to the given buffer.voidwriteArray(ProtonBuffer buffer, EncoderState state, byte[] value) Write the given array as with the proper array type encoding to the given buffer.voidwriteArray(ProtonBuffer buffer, EncoderState state, char[] value) Write the given array as with the proper array type encoding to the given buffer.voidwriteArray(ProtonBuffer buffer, EncoderState state, double[] value) Write the given array as with the proper array type encoding to the given buffer.voidwriteArray(ProtonBuffer buffer, EncoderState state, float[] value) Write the given array as with the proper array type encoding to the given buffer.voidwriteArray(ProtonBuffer buffer, EncoderState state, int[] value) Write the given array as with the proper array type encoding to the given buffer.voidwriteArray(ProtonBuffer buffer, EncoderState state, long[] value) Write the given array as with the proper array type encoding to the given buffer.voidwriteArray(ProtonBuffer buffer, EncoderState state, short[] value) Write the given array as with the proper array type encoding to the given buffer.voidwriteArray(ProtonBuffer buffer, EncoderState state, Object[] value) Write the given array as with the proper array type encoding to the given buffer.voidwriteArray(ProtonBuffer buffer, EncoderState state, UUID[] value) Write the given array as with the proper array type encoding to the given buffer.voidwriteArray(ProtonBuffer buffer, EncoderState state, Decimal128[] value) Write the given array as with the proper array type encoding to the given buffer.voidwriteArray(ProtonBuffer buffer, EncoderState state, Decimal32[] value) Write the given array as with the proper array type encoding to the given buffer.voidwriteArray(ProtonBuffer buffer, EncoderState state, Decimal64[] value) Write the given array as with the proper array type encoding to the given buffer.voidwriteArray(ProtonBuffer buffer, EncoderState state, Symbol[] value) Write the given array as with the proper array type encoding to the given buffer.voidwriteArray(ProtonBuffer buffer, EncoderState state, UnsignedByte[] value) Write the given array as with the proper array type encoding to the given buffer.voidwriteArray(ProtonBuffer buffer, EncoderState state, UnsignedInteger[] value) Write the given array as with the proper array type encoding to the given buffer.voidwriteArray(ProtonBuffer buffer, EncoderState state, UnsignedLong[] value) Write the given array as with the proper array type encoding to the given buffer.voidwriteArray(ProtonBuffer buffer, EncoderState state, UnsignedShort[] value) Write the given array as with the proper array type encoding to the given buffer.voidwriteBinary(ProtonBuffer buffer, EncoderState state, byte[] value) Writes the contents of the givenbytevalue into the providedProtonBufferinstance as an AMQP Binary type.voidwriteBinary(ProtonBuffer buffer, EncoderState state, ProtonBuffer value) Writes the contents of the givenProtonBuffervalue into the providedProtonBufferinstance as an AMQP Binary type.voidwriteBinary(ProtonBuffer buffer, EncoderState state, Binary value) Writes the contents of the givenBinaryvalue into the providedProtonBufferinstance as an AMQP Binary type.voidwriteBoolean(ProtonBuffer buffer, EncoderState state, boolean value) Write aBooleantype encoding to the given buffer.voidwriteBoolean(ProtonBuffer buffer, EncoderState state, Boolean value) Write aBooleantype encoding to the given buffer.voidwriteByte(ProtonBuffer buffer, EncoderState state, byte value) Write aBytetype encoding to the given buffer.voidwriteByte(ProtonBuffer buffer, EncoderState state, Byte value) Write aBytetype encoding to the given buffer.voidwriteCharacter(ProtonBuffer buffer, EncoderState state, char value) Write aCharactertype encoding to the given buffer.voidwriteCharacter(ProtonBuffer buffer, EncoderState state, Character value) Write aCharactertype encoding to the given buffer.voidwriteDecimal128(ProtonBuffer buffer, EncoderState state, Decimal128 value) Write aDecimal128type encoding to the given buffer.voidwriteDecimal32(ProtonBuffer buffer, EncoderState state, Decimal32 value) Write aDecimal32type encoding to the given buffer.voidwriteDecimal64(ProtonBuffer buffer, EncoderState state, Decimal64 value) Write aDecimal64type encoding to the given buffer.voidwriteDeliveryTag(ProtonBuffer buffer, EncoderState state, DeliveryTag value) Writes the contents of the givenDeliveryTagvalue into the providedProtonBufferinstance as an AMQP Binary type.voidwriteDescribedType(ProtonBuffer buffer, EncoderState state, DescribedType value) Write aDescribedTypetype encoding to the given buffer.voidwriteDouble(ProtonBuffer buffer, EncoderState state, double value) Write aDoubletype encoding to the given buffer.voidwriteDouble(ProtonBuffer buffer, EncoderState state, Double value) Write aDoubletype encoding to the given buffer.voidwriteFloat(ProtonBuffer buffer, EncoderState state, float value) Write aFloattype encoding to the given buffer.voidwriteFloat(ProtonBuffer buffer, EncoderState state, Float value) Write aFloattype encoding to the given buffer.voidwriteInteger(ProtonBuffer buffer, EncoderState state, int value) Write aIntegertype encoding to the given buffer.voidwriteInteger(ProtonBuffer buffer, EncoderState state, Integer value) Write aIntegertype encoding to the given buffer.<T> voidwriteList(ProtonBuffer buffer, EncoderState state, List<T> value) Write aListtype encoding to the given buffer.voidwriteLong(ProtonBuffer buffer, EncoderState state, long value) Write aLongtype encoding to the given buffer.voidwriteLong(ProtonBuffer buffer, EncoderState state, Long value) Write aLongtype encoding to the given buffer.<K,V> void writeMap(ProtonBuffer buffer, EncoderState state, Map<K, V> value) Write aMaptype encoding to the given buffer.voidwriteNull(ProtonBuffer buffer, EncoderState state) Write a Null type encoding to the given buffer.voidwriteObject(ProtonBuffer buffer, EncoderState state, Object value) Write the proper type encoding for the providedObjectto the given buffer if anTypeEncodercan be found for it in the collection of registered type encoders..voidwriteShort(ProtonBuffer buffer, EncoderState state, short value) Write aShorttype encoding to the given buffer.voidwriteShort(ProtonBuffer buffer, EncoderState state, Short value) Write aShorttype encoding to the given buffer.voidwriteString(ProtonBuffer buffer, EncoderState state, String value) Write aStringtype encoding to the given buffer.voidwriteSymbol(ProtonBuffer buffer, EncoderState state, String value) Write aSymboltype encoding to the given buffer.voidwriteSymbol(ProtonBuffer buffer, EncoderState state, Symbol value) Write aSymboltype encoding to the given buffer.voidwriteTimestamp(ProtonBuffer buffer, EncoderState state, long value) Write a Time stamp type encoding to the given buffer.voidwriteTimestamp(ProtonBuffer buffer, EncoderState state, Date value) Write a Time stamp type encoding to the given buffer.voidwriteUnsignedByte(ProtonBuffer buffer, EncoderState state, byte value) Write anUnsignedBytetype encoding to the given buffer.voidwriteUnsignedByte(ProtonBuffer buffer, EncoderState state, UnsignedByte value) Write anUnsignedBytetype encoding to the given buffer.voidwriteUnsignedInteger(ProtonBuffer buffer, EncoderState state, byte value) Write aUnsignedIntegertype encoding to the given buffer.voidwriteUnsignedInteger(ProtonBuffer buffer, EncoderState state, int value) Write aUnsignedIntegertype encoding to the given buffer.voidwriteUnsignedInteger(ProtonBuffer buffer, EncoderState state, long value) Write aUnsignedIntegertype encoding to the given buffer using the provided value with appropriate range checks to ensure invalid input is not accepted.voidwriteUnsignedInteger(ProtonBuffer buffer, EncoderState state, UnsignedInteger value) Write aUnsignedIntegertype encoding to the given buffer.voidwriteUnsignedLong(ProtonBuffer buffer, EncoderState state, byte value) Write aUnsignedLongtype encoding to the given buffer.voidwriteUnsignedLong(ProtonBuffer buffer, EncoderState state, long value) Write aUnsignedLongtype encoding to the given buffer.voidwriteUnsignedLong(ProtonBuffer buffer, EncoderState state, UnsignedLong value) Write aUnsignedLongtype encoding to the given buffer.voidwriteUnsignedShort(ProtonBuffer buffer, EncoderState state, int value) Write aUnsignedShorttype encoding to the given buffer using the provided value with appropriate range checks to ensure invalid input is not accepted.voidwriteUnsignedShort(ProtonBuffer buffer, EncoderState state, short value) Write aUnsignedShorttype encoding to the given buffer.voidwriteUnsignedShort(ProtonBuffer buffer, EncoderState state, UnsignedShort value) Write aUnsignedShorttype encoding to the given buffer.voidwriteUUID(ProtonBuffer buffer, EncoderState state, UUID value) Write aUUIDtype encoding to the given buffer.
-
Constructor Details
-
ProtonEncoder
public ProtonEncoder()
-
-
Method Details
-
newEncoderState
Description copied from interface:EncoderCreates a newEncoderStateinstance that can be used when interacting with the Encoder. For encoding that occurs on more than one thread while sharing a singleEncoderinstance a different state object per thread is required as theEncoderStateobject can retain some state information during the encode process that could be corrupted if more than one thread were to share a single instance. For single threaded encoding work theEncoderoffers a utility cachedEncoderStateAPI that will return the same instance on each call which can reduce allocation overhead and make using theEncodersimpler.- Specified by:
newEncoderStatein interfaceEncoder- Returns:
- a newly constructed
EncoderStateinstance.
-
getCachedEncoderState
Description copied from interface:EncoderReturn a singletonEncoderStateinstance that is meant to be shared within single threaded encoder interactions. If more than one thread makes use of this cacheEncoderStatethe results of any encoding done using this state object is not guaranteed to be correct. The returned instance will have its reset method called to ensure that any previously stored state data is cleared before the next use.- Specified by:
getCachedEncoderStatein interfaceEncoder- Returns:
- a cached
EncoderStatelinked to this Encoder instance.
-
writeNull
Description copied from interface:EncoderWrite a Null type encoding to the given buffer.- Specified by:
writeNullin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeBoolean
public void writeBoolean(ProtonBuffer buffer, EncoderState state, boolean value) throws EncodeException Description copied from interface:EncoderWrite aBooleantype encoding to the given buffer.- Specified by:
writeBooleanin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeBoolean
public void writeBoolean(ProtonBuffer buffer, EncoderState state, Boolean value) throws EncodeException Description copied from interface:EncoderWrite aBooleantype encoding to the given buffer.- Specified by:
writeBooleanin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeUnsignedByte
public void writeUnsignedByte(ProtonBuffer buffer, EncoderState state, UnsignedByte value) throws EncodeException Description copied from interface:EncoderWrite anUnsignedBytetype encoding to the given buffer.- Specified by:
writeUnsignedBytein interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeUnsignedByte
public void writeUnsignedByte(ProtonBuffer buffer, EncoderState state, byte value) throws EncodeException Description copied from interface:EncoderWrite anUnsignedBytetype encoding to the given buffer.- Specified by:
writeUnsignedBytein interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeUnsignedShort
public void writeUnsignedShort(ProtonBuffer buffer, EncoderState state, UnsignedShort value) throws EncodeException Description copied from interface:EncoderWrite aUnsignedShorttype encoding to the given buffer.- Specified by:
writeUnsignedShortin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeUnsignedShort
public void writeUnsignedShort(ProtonBuffer buffer, EncoderState state, short value) throws EncodeException Description copied from interface:EncoderWrite aUnsignedShorttype encoding to the given buffer.- Specified by:
writeUnsignedShortin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeUnsignedShort
public void writeUnsignedShort(ProtonBuffer buffer, EncoderState state, int value) throws EncodeException Description copied from interface:EncoderWrite aUnsignedShorttype encoding to the given buffer using the provided value with appropriate range checks to ensure invalid input is not accepted.- Specified by:
writeUnsignedShortin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeUnsignedInteger
public void writeUnsignedInteger(ProtonBuffer buffer, EncoderState state, UnsignedInteger value) throws EncodeException Description copied from interface:EncoderWrite aUnsignedIntegertype encoding to the given buffer.- Specified by:
writeUnsignedIntegerin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeUnsignedInteger
public void writeUnsignedInteger(ProtonBuffer buffer, EncoderState state, byte value) throws EncodeException Description copied from interface:EncoderWrite aUnsignedIntegertype encoding to the given buffer.- Specified by:
writeUnsignedIntegerin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeUnsignedInteger
public void writeUnsignedInteger(ProtonBuffer buffer, EncoderState state, int value) throws EncodeException Description copied from interface:EncoderWrite aUnsignedIntegertype encoding to the given buffer.- Specified by:
writeUnsignedIntegerin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeUnsignedInteger
public void writeUnsignedInteger(ProtonBuffer buffer, EncoderState state, long value) throws EncodeException Description copied from interface:EncoderWrite aUnsignedIntegertype encoding to the given buffer using the provided value with appropriate range checks to ensure invalid input is not accepted.- Specified by:
writeUnsignedIntegerin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeUnsignedLong
public void writeUnsignedLong(ProtonBuffer buffer, EncoderState state, byte value) throws EncodeException Description copied from interface:EncoderWrite aUnsignedLongtype encoding to the given buffer.- Specified by:
writeUnsignedLongin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeUnsignedLong
public void writeUnsignedLong(ProtonBuffer buffer, EncoderState state, long value) throws EncodeException Description copied from interface:EncoderWrite aUnsignedLongtype encoding to the given buffer.- Specified by:
writeUnsignedLongin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeUnsignedLong
public void writeUnsignedLong(ProtonBuffer buffer, EncoderState state, UnsignedLong value) throws EncodeException Description copied from interface:EncoderWrite aUnsignedLongtype encoding to the given buffer.- Specified by:
writeUnsignedLongin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeByte
Description copied from interface:EncoderWrite aBytetype encoding to the given buffer.- Specified by:
writeBytein interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeByte
Description copied from interface:EncoderWrite aBytetype encoding to the given buffer.- Specified by:
writeBytein interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeShort
Description copied from interface:EncoderWrite aShorttype encoding to the given buffer.- Specified by:
writeShortin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeShort
Description copied from interface:EncoderWrite aShorttype encoding to the given buffer.- Specified by:
writeShortin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeInteger
Description copied from interface:EncoderWrite aIntegertype encoding to the given buffer.- Specified by:
writeIntegerin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeInteger
public void writeInteger(ProtonBuffer buffer, EncoderState state, Integer value) throws EncodeException Description copied from interface:EncoderWrite aIntegertype encoding to the given buffer.- Specified by:
writeIntegerin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeLong
Description copied from interface:EncoderWrite aLongtype encoding to the given buffer.- Specified by:
writeLongin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeLong
Description copied from interface:EncoderWrite aLongtype encoding to the given buffer.- Specified by:
writeLongin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeFloat
Description copied from interface:EncoderWrite aFloattype encoding to the given buffer.- Specified by:
writeFloatin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeFloat
Description copied from interface:EncoderWrite aFloattype encoding to the given buffer.- Specified by:
writeFloatin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeDouble
public void writeDouble(ProtonBuffer buffer, EncoderState state, double value) throws EncodeException Description copied from interface:EncoderWrite aDoubletype encoding to the given buffer.- Specified by:
writeDoublein interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeDouble
public void writeDouble(ProtonBuffer buffer, EncoderState state, Double value) throws EncodeException Description copied from interface:EncoderWrite aDoubletype encoding to the given buffer.- Specified by:
writeDoublein interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeDecimal32
public void writeDecimal32(ProtonBuffer buffer, EncoderState state, Decimal32 value) throws EncodeException Description copied from interface:EncoderWrite aDecimal32type encoding to the given buffer.- Specified by:
writeDecimal32in interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeDecimal64
public void writeDecimal64(ProtonBuffer buffer, EncoderState state, Decimal64 value) throws EncodeException Description copied from interface:EncoderWrite aDecimal64type encoding to the given buffer.- Specified by:
writeDecimal64in interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeDecimal128
public void writeDecimal128(ProtonBuffer buffer, EncoderState state, Decimal128 value) throws EncodeException Description copied from interface:EncoderWrite aDecimal128type encoding to the given buffer.- Specified by:
writeDecimal128in interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeCharacter
public void writeCharacter(ProtonBuffer buffer, EncoderState state, char value) throws EncodeException Description copied from interface:EncoderWrite aCharactertype encoding to the given buffer.- Specified by:
writeCharacterin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeCharacter
public void writeCharacter(ProtonBuffer buffer, EncoderState state, Character value) throws EncodeException Description copied from interface:EncoderWrite aCharactertype encoding to the given buffer.- Specified by:
writeCharacterin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeTimestamp
public void writeTimestamp(ProtonBuffer buffer, EncoderState state, long value) throws EncodeException Description copied from interface:EncoderWrite a Time stamp type encoding to the given buffer.- Specified by:
writeTimestampin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeTimestamp
public void writeTimestamp(ProtonBuffer buffer, EncoderState state, Date value) throws EncodeException Description copied from interface:EncoderWrite a Time stamp type encoding to the given buffer.- Specified by:
writeTimestampin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeUUID
Description copied from interface:EncoderWrite aUUIDtype encoding to the given buffer.- Specified by:
writeUUIDin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeBinary
public void writeBinary(ProtonBuffer buffer, EncoderState state, Binary value) throws EncodeException Description copied from interface:EncoderWrites the contents of the givenBinaryvalue into the providedProtonBufferinstance as an AMQP Binary type.If the provided value to write is null an AMQP null type is encoded into the target buffer.
- Specified by:
writeBinaryin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeBinary
public void writeBinary(ProtonBuffer buffer, EncoderState state, ProtonBuffer value) throws EncodeException Description copied from interface:EncoderWrites the contents of the givenProtonBuffervalue into the providedProtonBufferinstance as an AMQP Binary type. This method does not modify the read index of the value given such that is can be read later or written again without needing to reset the read index manually.If the provided value to write is null an AMQP null type is encoded into the target buffer.
- Specified by:
writeBinaryin interfaceEncoder- Parameters:
buffer- the target buffer where the binary value is to be encodedstate- theEncoderStateinstance that manages the calling threads state tracking.value- theProtonBuffervalue to be encoded as an AMQP binary instance.- Throws:
EncodeException- if an error occurs while performing the encode
-
writeBinary
public void writeBinary(ProtonBuffer buffer, EncoderState state, byte[] value) throws EncodeException Description copied from interface:EncoderWrites the contents of the givenbytevalue into the providedProtonBufferinstance as an AMQP Binary type.If the provided value to write is null an AMQP null type is encoded into the target buffer.
- Specified by:
writeBinaryin interfaceEncoder- Parameters:
buffer- the target buffer where the binary value is to be encodedstate- theEncoderStateinstance that manages the calling threads state tracking.value- theProtonBuffervalue to be encoded as an AMQP binary instance.- Throws:
EncodeException- if an error occurs while performing the encode
-
writeDeliveryTag
public void writeDeliveryTag(ProtonBuffer buffer, EncoderState state, DeliveryTag value) throws EncodeException Description copied from interface:EncoderWrites the contents of the givenDeliveryTagvalue into the providedProtonBufferinstance as an AMQP Binary type.If the provided value to write is null an AMQP null type is encoded into the target buffer.
- Specified by:
writeDeliveryTagin interfaceEncoder- Parameters:
buffer- the target buffer where the binary value is to be encodedstate- theEncoderStateinstance that manages the calling threads state tracking.value- theDeliveryTagvalue to be encoded as an AMQP binary instance.- Throws:
EncodeException- if an error occurs while performing the encode
-
writeString
public void writeString(ProtonBuffer buffer, EncoderState state, String value) throws EncodeException Description copied from interface:EncoderWrite aStringtype encoding to the given buffer.- Specified by:
writeStringin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeSymbol
public void writeSymbol(ProtonBuffer buffer, EncoderState state, Symbol value) throws EncodeException Description copied from interface:EncoderWrite aSymboltype encoding to the given buffer.- Specified by:
writeSymbolin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeSymbol
public void writeSymbol(ProtonBuffer buffer, EncoderState state, String value) throws EncodeException Description copied from interface:EncoderWrite aSymboltype encoding to the given buffer. The providedStringinstance should contain only ASCII characters and the encoder should throw anEncodeExceptionif a non-ASCII character is encountered.- Specified by:
writeSymbolin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeList
public <T> void writeList(ProtonBuffer buffer, EncoderState state, List<T> value) throws EncodeException Description copied from interface:EncoderWrite aListtype encoding to the given buffer.- Specified by:
writeListin interfaceEncoder- Type Parameters:
T- The type that comprises theListentries.- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeMap
public <K,V> void writeMap(ProtonBuffer buffer, EncoderState state, Map<K, V> value) throws EncodeExceptionDescription copied from interface:EncoderWrite aMaptype encoding to the given buffer.- Specified by:
writeMapin interfaceEncoder- Type Parameters:
K- the type that comprises theMapkeys.V- the type that comprises theMapvalues.- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeDescribedType
public void writeDescribedType(ProtonBuffer buffer, EncoderState state, DescribedType value) throws EncodeException Description copied from interface:EncoderWrite aDescribedTypetype encoding to the given buffer.- Specified by:
writeDescribedTypein interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeArray
public void writeArray(ProtonBuffer buffer, EncoderState state, boolean[] value) throws EncodeException Description copied from interface:EncoderWrite the given array as with the proper array type encoding to the given buffer.- Specified by:
writeArrayin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeArray
public void writeArray(ProtonBuffer buffer, EncoderState state, byte[] value) throws EncodeException Description copied from interface:EncoderWrite the given array as with the proper array type encoding to the given buffer.- Specified by:
writeArrayin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeArray
public void writeArray(ProtonBuffer buffer, EncoderState state, short[] value) throws EncodeException Description copied from interface:EncoderWrite the given array as with the proper array type encoding to the given buffer.- Specified by:
writeArrayin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeArray
Description copied from interface:EncoderWrite the given array as with the proper array type encoding to the given buffer.- Specified by:
writeArrayin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeArray
public void writeArray(ProtonBuffer buffer, EncoderState state, long[] value) throws EncodeException Description copied from interface:EncoderWrite the given array as with the proper array type encoding to the given buffer.- Specified by:
writeArrayin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeArray
public void writeArray(ProtonBuffer buffer, EncoderState state, float[] value) throws EncodeException Description copied from interface:EncoderWrite the given array as with the proper array type encoding to the given buffer.- Specified by:
writeArrayin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeArray
public void writeArray(ProtonBuffer buffer, EncoderState state, double[] value) throws EncodeException Description copied from interface:EncoderWrite the given array as with the proper array type encoding to the given buffer.- Specified by:
writeArrayin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeArray
public void writeArray(ProtonBuffer buffer, EncoderState state, char[] value) throws EncodeException Description copied from interface:EncoderWrite the given array as with the proper array type encoding to the given buffer.- Specified by:
writeArrayin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeArray
public void writeArray(ProtonBuffer buffer, EncoderState state, Object[] value) throws EncodeException Description copied from interface:EncoderWrite the given array as with the proper array type encoding to the given buffer.- Specified by:
writeArrayin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeArray
public void writeArray(ProtonBuffer buffer, EncoderState state, Decimal32[] value) throws EncodeException Description copied from interface:EncoderWrite the given array as with the proper array type encoding to the given buffer.- Specified by:
writeArrayin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeArray
public void writeArray(ProtonBuffer buffer, EncoderState state, Decimal64[] value) throws EncodeException Description copied from interface:EncoderWrite the given array as with the proper array type encoding to the given buffer.- Specified by:
writeArrayin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeArray
public void writeArray(ProtonBuffer buffer, EncoderState state, Decimal128[] value) throws EncodeException Description copied from interface:EncoderWrite the given array as with the proper array type encoding to the given buffer.- Specified by:
writeArrayin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeArray
public void writeArray(ProtonBuffer buffer, EncoderState state, Symbol[] value) throws EncodeException Description copied from interface:EncoderWrite the given array as with the proper array type encoding to the given buffer.- Specified by:
writeArrayin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeArray
public void writeArray(ProtonBuffer buffer, EncoderState state, UnsignedByte[] value) throws EncodeException Description copied from interface:EncoderWrite the given array as with the proper array type encoding to the given buffer.- Specified by:
writeArrayin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeArray
public void writeArray(ProtonBuffer buffer, EncoderState state, UnsignedShort[] value) throws EncodeException Description copied from interface:EncoderWrite the given array as with the proper array type encoding to the given buffer.- Specified by:
writeArrayin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeArray
public void writeArray(ProtonBuffer buffer, EncoderState state, UnsignedInteger[] value) throws EncodeException Description copied from interface:EncoderWrite the given array as with the proper array type encoding to the given buffer.- Specified by:
writeArrayin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeArray
public void writeArray(ProtonBuffer buffer, EncoderState state, UnsignedLong[] value) throws EncodeException Description copied from interface:EncoderWrite the given array as with the proper array type encoding to the given buffer.- Specified by:
writeArrayin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeArray
public void writeArray(ProtonBuffer buffer, EncoderState state, UUID[] value) throws EncodeException Description copied from interface:EncoderWrite the given array as with the proper array type encoding to the given buffer.- Specified by:
writeArrayin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
writeObject
public void writeObject(ProtonBuffer buffer, EncoderState state, Object value) throws EncodeException Description copied from interface:EncoderWrite the proper type encoding for the providedObjectto the given buffer if anTypeEncodercan be found for it in the collection of registered type encoders..- Specified by:
writeObjectin interfaceEncoder- Parameters:
buffer- The buffer where the write operation is targetedstate- TheEncoderStateto use for any intermediate encoding work.value- The value to be encoded into the provided buffer.- Throws:
EncodeException- if an error occurs during the encode operation.
-
registerDescribedTypeEncoder
Description copied from interface:EncoderRegister aDescribedTypeEncoderwhich can be used when writing custom types using this encoder. When an Object write is performed the type encoder registry will be consulted in order to find the best match for the givenObjectinstance.- Specified by:
registerDescribedTypeEncoderin interfaceEncoder- Type Parameters:
V- The type that the encoder handles.- Parameters:
encoder- A newDescribedTypeEncoderthat will be used when encoding its matching type.- Returns:
- this
Encoderinstance.
-
getTypeEncoder
Description copied from interface:EncoderLookup aTypeEncoderthat would be used to encode the givenObject.- Specified by:
getTypeEncoderin interfaceEncoder- Parameters:
value- The value which should be used to resolve theTypeEncoderthat encodes it.- Returns:
- the matching
TypeEncoderfor the given value or null if no match found.
-
getTypeEncoder
Description copied from interface:EncoderLookup aTypeEncoderthat would be used to encode the givenClass.- Specified by:
getTypeEncoderin interfaceEncoder- Parameters:
typeClass- TheClasswhich should be used to resolve theTypeEncoderthat encodes it.- Returns:
- the matching
TypeEncoderfor the given value or null if no match found.
-
getTypeEncoder
Lookup aTypeEncoderby first checking the given typeClassand then if none found to deduce a valid TypeEncoder from theObjectspecified.- Parameters:
typeClass- TheClassfor which a type specific encoder is requested.instance- AnObjectinstance to use as a fall back if no encoder found for theClass- Returns:
- a
TypeEncoderif a match to the given query is found or null of non can be deduced.
-