Package org.apache.qpid.protonj2.codec
Interface Encoder
- All Known Implementing Classes:
ProtonEncoder
public interface Encoder
Encode AMQP types into binary streams
-
Method Summary
Modifier and TypeMethodDescriptionReturn a singletonEncoderState
instance that is meant to be shared within single threaded encoder interactions.TypeEncoder
<?> getTypeEncoder
(Class<?> typeClass) Lookup aTypeEncoder
that would be used to encode the givenClass
.TypeEncoder
<?> getTypeEncoder
(Object value) Lookup aTypeEncoder
that would be used to encode the givenObject
.Creates a newEncoderState
instance that can be used when interacting with the Encoder.<V> Encoder
registerDescribedTypeEncoder
(DescribedTypeEncoder<V> encoder) Register aDescribedTypeEncoder
which can be used when writing custom types using this encoder.void
writeArray
(ProtonBuffer buffer, EncoderState state, boolean[] value) Write the given array as with the proper array type encoding to the given buffer.void
writeArray
(ProtonBuffer buffer, EncoderState state, byte[] value) Write the given array as with the proper array type encoding to the given buffer.void
writeArray
(ProtonBuffer buffer, EncoderState state, char[] value) Write the given array as with the proper array type encoding to the given buffer.void
writeArray
(ProtonBuffer buffer, EncoderState state, double[] value) Write the given array as with the proper array type encoding to the given buffer.void
writeArray
(ProtonBuffer buffer, EncoderState state, float[] value) Write the given array as with the proper array type encoding to the given buffer.void
writeArray
(ProtonBuffer buffer, EncoderState state, int[] value) Write the given array as with the proper array type encoding to the given buffer.void
writeArray
(ProtonBuffer buffer, EncoderState state, long[] value) Write the given array as with the proper array type encoding to the given buffer.void
writeArray
(ProtonBuffer buffer, EncoderState state, short[] value) Write the given array as with the proper array type encoding to the given buffer.void
writeArray
(ProtonBuffer buffer, EncoderState state, Object[] value) Write the given array as with the proper array type encoding to the given buffer.void
writeArray
(ProtonBuffer buffer, EncoderState state, UUID[] value) Write the given array as with the proper array type encoding to the given buffer.void
writeArray
(ProtonBuffer buffer, EncoderState state, Decimal128[] value) Write the given array as with the proper array type encoding to the given buffer.void
writeArray
(ProtonBuffer buffer, EncoderState state, Decimal32[] value) Write the given array as with the proper array type encoding to the given buffer.void
writeArray
(ProtonBuffer buffer, EncoderState state, Decimal64[] value) Write the given array as with the proper array type encoding to the given buffer.void
writeArray
(ProtonBuffer buffer, EncoderState state, Symbol[] value) Write the given array as with the proper array type encoding to the given buffer.void
writeArray
(ProtonBuffer buffer, EncoderState state, UnsignedByte[] value) Write the given array as with the proper array type encoding to the given buffer.void
writeArray
(ProtonBuffer buffer, EncoderState state, UnsignedInteger[] value) Write the given array as with the proper array type encoding to the given buffer.void
writeArray
(ProtonBuffer buffer, EncoderState state, UnsignedLong[] value) Write the given array as with the proper array type encoding to the given buffer.void
writeArray
(ProtonBuffer buffer, EncoderState state, UnsignedShort[] value) Write the given array as with the proper array type encoding to the given buffer.void
writeBinary
(ProtonBuffer buffer, EncoderState state, byte[] value) Writes the contents of the giveninvalid reference
byte[]
ProtonBuffer
instance as an AMQP Binary type.void
writeBinary
(ProtonBuffer buffer, EncoderState state, ProtonBuffer value) Writes the contents of the givenProtonBuffer
value into the providedProtonBuffer
instance as an AMQP Binary type.void
writeBinary
(ProtonBuffer buffer, EncoderState state, Binary value) Writes the contents of the givenBinary
value into the providedProtonBuffer
instance as an AMQP Binary type.void
writeBoolean
(ProtonBuffer buffer, EncoderState state, boolean value) Write aBoolean
type encoding to the given buffer.void
writeBoolean
(ProtonBuffer buffer, EncoderState state, Boolean value) Write aBoolean
type encoding to the given buffer.void
writeByte
(ProtonBuffer buffer, EncoderState state, byte value) Write aByte
type encoding to the given buffer.void
writeByte
(ProtonBuffer buffer, EncoderState state, Byte value) Write aByte
type encoding to the given buffer.void
writeCharacter
(ProtonBuffer buffer, EncoderState state, char value) Write aCharacter
type encoding to the given buffer.void
writeCharacter
(ProtonBuffer buffer, EncoderState state, Character value) Write aCharacter
type encoding to the given buffer.void
writeDecimal128
(ProtonBuffer buffer, EncoderState state, Decimal128 value) Write aDecimal128
type encoding to the given buffer.void
writeDecimal32
(ProtonBuffer buffer, EncoderState state, Decimal32 value) Write aDecimal32
type encoding to the given buffer.void
writeDecimal64
(ProtonBuffer buffer, EncoderState state, Decimal64 value) Write aDecimal64
type encoding to the given buffer.void
writeDeliveryTag
(ProtonBuffer buffer, EncoderState state, DeliveryTag value) Writes the contents of the givenDeliveryTag
value into the providedProtonBuffer
instance as an AMQP Binary type.void
writeDescribedType
(ProtonBuffer buffer, EncoderState state, DescribedType value) Write aDescribedType
type encoding to the given buffer.void
writeDouble
(ProtonBuffer buffer, EncoderState state, double value) Write aDouble
type encoding to the given buffer.void
writeDouble
(ProtonBuffer buffer, EncoderState state, Double value) Write aDouble
type encoding to the given buffer.void
writeFloat
(ProtonBuffer buffer, EncoderState state, float value) Write aFloat
type encoding to the given buffer.void
writeFloat
(ProtonBuffer buffer, EncoderState state, Float value) Write aFloat
type encoding to the given buffer.void
writeInteger
(ProtonBuffer buffer, EncoderState state, int value) Write aInteger
type encoding to the given buffer.void
writeInteger
(ProtonBuffer buffer, EncoderState state, Integer value) Write aInteger
type encoding to the given buffer.<T> void
writeList
(ProtonBuffer buffer, EncoderState state, List<T> value) Write aList
type encoding to the given buffer.void
writeLong
(ProtonBuffer buffer, EncoderState state, long value) Write aLong
type encoding to the given buffer.void
writeLong
(ProtonBuffer buffer, EncoderState state, Long value) Write aLong
type encoding to the given buffer.<K,
V> void writeMap
(ProtonBuffer buffer, EncoderState state, Map<K, V> value) Write aMap
type encoding to the given buffer.void
writeNull
(ProtonBuffer buffer, EncoderState state) Write a Null type encoding to the given buffer.void
writeObject
(ProtonBuffer buffer, EncoderState state, Object value) Write the proper type encoding for the providedObject
to the given buffer if anTypeEncoder
can be found for it in the collection of registered type encoders..void
writeShort
(ProtonBuffer buffer, EncoderState state, short value) Write aShort
type encoding to the given buffer.void
writeShort
(ProtonBuffer buffer, EncoderState state, Short value) Write aShort
type encoding to the given buffer.void
writeString
(ProtonBuffer buffer, EncoderState state, String value) Write aString
type encoding to the given buffer.void
writeSymbol
(ProtonBuffer buffer, EncoderState state, String value) Write aSymbol
type encoding to the given buffer.void
writeSymbol
(ProtonBuffer buffer, EncoderState state, Symbol value) Write aSymbol
type encoding to the given buffer.void
writeTimestamp
(ProtonBuffer buffer, EncoderState state, long value) Write a Time stamp type encoding to the given buffer.void
writeTimestamp
(ProtonBuffer buffer, EncoderState state, Date value) Write a Time stamp type encoding to the given buffer.void
writeUnsignedByte
(ProtonBuffer buffer, EncoderState state, byte value) Write anUnsignedByte
type encoding to the given buffer.void
writeUnsignedByte
(ProtonBuffer buffer, EncoderState state, UnsignedByte value) Write anUnsignedByte
type encoding to the given buffer.void
writeUnsignedInteger
(ProtonBuffer buffer, EncoderState state, byte value) Write aUnsignedInteger
type encoding to the given buffer.void
writeUnsignedInteger
(ProtonBuffer buffer, EncoderState state, int value) Write aUnsignedInteger
type encoding to the given buffer.void
writeUnsignedInteger
(ProtonBuffer buffer, EncoderState state, long value) Write aUnsignedInteger
type encoding to the given buffer using the provided value with appropriate range checks to ensure invalid input is not accepted.void
writeUnsignedInteger
(ProtonBuffer buffer, EncoderState state, UnsignedInteger value) Write aUnsignedInteger
type encoding to the given buffer.void
writeUnsignedLong
(ProtonBuffer buffer, EncoderState state, byte value) Write aUnsignedLong
type encoding to the given buffer.void
writeUnsignedLong
(ProtonBuffer buffer, EncoderState state, long value) Write aUnsignedLong
type encoding to the given buffer.void
writeUnsignedLong
(ProtonBuffer buffer, EncoderState state, UnsignedLong value) Write aUnsignedLong
type encoding to the given buffer.void
writeUnsignedShort
(ProtonBuffer buffer, EncoderState state, int value) Write aUnsignedShort
type encoding to the given buffer using the provided value with appropriate range checks to ensure invalid input is not accepted.void
writeUnsignedShort
(ProtonBuffer buffer, EncoderState state, short value) Write aUnsignedShort
type encoding to the given buffer.void
writeUnsignedShort
(ProtonBuffer buffer, EncoderState state, UnsignedShort value) Write aUnsignedShort
type encoding to the given buffer.void
writeUUID
(ProtonBuffer buffer, EncoderState state, UUID value) Write aUUID
type encoding to the given buffer.
-
Method Details
-
newEncoderState
EncoderState newEncoderState()Creates a newEncoderState
instance that can be used when interacting with the Encoder. For encoding that occurs on more than one thread while sharing a singleEncoder
instance a different state object per thread is required as theEncoderState
object 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 theEncoder
offers a utility cachedEncoderState
API that will return the same instance on each call which can reduce allocation overhead and make using theEncoder
simpler.- Returns:
- a newly constructed
EncoderState
instance.
-
getCachedEncoderState
EncoderState getCachedEncoderState()Return a singletonEncoderState
instance that is meant to be shared within single threaded encoder interactions. If more than one thread makes use of this cacheEncoderState
the 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.- Returns:
- a cached
EncoderState
linked to this Encoder instance.
-
writeNull
Write a Null type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to use for any intermediate encoding work.- Throws:
EncodeException
- if an error occurs during the encode operation.
-
writeBoolean
Write aBoolean
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aBoolean
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
void writeUnsignedByte(ProtonBuffer buffer, EncoderState state, UnsignedByte value) throws EncodeException Write anUnsignedByte
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write anUnsignedByte
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
void writeUnsignedShort(ProtonBuffer buffer, EncoderState state, UnsignedShort value) throws EncodeException Write aUnsignedShort
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
void writeUnsignedShort(ProtonBuffer buffer, EncoderState state, short value) throws EncodeException Write aUnsignedShort
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aUnsignedShort
type encoding to the given buffer using the provided value with appropriate range checks to ensure invalid input is not accepted.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
void writeUnsignedInteger(ProtonBuffer buffer, EncoderState state, UnsignedInteger value) throws EncodeException Write aUnsignedInteger
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
void writeUnsignedInteger(ProtonBuffer buffer, EncoderState state, byte value) throws EncodeException Write aUnsignedInteger
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
void writeUnsignedInteger(ProtonBuffer buffer, EncoderState state, int value) throws EncodeException Write aUnsignedInteger
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
void writeUnsignedInteger(ProtonBuffer buffer, EncoderState state, long value) throws EncodeException Write aUnsignedInteger
type encoding to the given buffer using the provided value with appropriate range checks to ensure invalid input is not accepted.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
void writeUnsignedLong(ProtonBuffer buffer, EncoderState state, UnsignedLong value) throws EncodeException Write aUnsignedLong
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aUnsignedLong
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aUnsignedLong
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aByte
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aByte
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aShort
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aShort
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aInteger
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aInteger
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aLong
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aLong
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aFloat
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aFloat
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aDouble
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aDouble
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
void writeDecimal32(ProtonBuffer buffer, EncoderState state, Decimal32 value) throws EncodeException Write aDecimal32
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
void writeDecimal64(ProtonBuffer buffer, EncoderState state, Decimal64 value) throws EncodeException Write aDecimal64
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
void writeDecimal128(ProtonBuffer buffer, EncoderState state, Decimal128 value) throws EncodeException Write aDecimal128
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aCharacter
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
void writeCharacter(ProtonBuffer buffer, EncoderState state, Character value) throws EncodeException Write aCharacter
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write a Time stamp type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write a Time stamp type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aUUID
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Writes the contents of the givenBinary
value into the providedProtonBuffer
instance as an AMQP Binary type.If the provided value to write is null an AMQP null type is encoded into the target buffer.
- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
void writeBinary(ProtonBuffer buffer, EncoderState state, ProtonBuffer value) throws EncodeException Writes the contents of the givenProtonBuffer
value into the providedProtonBuffer
instance 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.
- Parameters:
buffer
- the target buffer where the binary value is to be encodedstate
- theEncoderState
instance that manages the calling threads state tracking.value
- theProtonBuffer
value to be encoded as an AMQP binary instance.- Throws:
EncodeException
- if an error occurs while performing the encode
-
writeBinary
Writes the contents of the giveninvalid reference
byte[]
ProtonBuffer
instance as an AMQP Binary type.If the provided value to write is null an AMQP null type is encoded into the target buffer.
- Parameters:
buffer
- the target buffer where the binary value is to be encodedstate
- theEncoderState
instance that manages the calling threads state tracking.value
- theProtonBuffer
value to be encoded as an AMQP binary instance.- Throws:
EncodeException
- if an error occurs while performing the encode
-
writeString
Write aString
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aSymbol
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aSymbol
type encoding to the given buffer. The providedString
instance should contain only ASCII characters and the encoder should throw anEncodeException
if a non-ASCII character is encountered.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write aList
type encoding to the given buffer.- Type Parameters:
T
- The type that comprises theList
entries.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
<K,V> void writeMap(ProtonBuffer buffer, EncoderState state, Map<K, V> value) throws EncodeExceptionWrite aMap
type encoding to the given buffer.- Type Parameters:
K
- the type that comprises theMap
keys.V
- the type that comprises theMap
values.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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.
-
writeDeliveryTag
void writeDeliveryTag(ProtonBuffer buffer, EncoderState state, DeliveryTag value) throws EncodeException Writes the contents of the givenDeliveryTag
value into the providedProtonBuffer
instance as an AMQP Binary type.If the provided value to write is null an AMQP null type is encoded into the target buffer.
- Parameters:
buffer
- the target buffer where the binary value is to be encodedstate
- theEncoderState
instance that manages the calling threads state tracking.value
- theDeliveryTag
value to be encoded as an AMQP binary instance.- Throws:
EncodeException
- if an error occurs while performing the encode
-
writeDescribedType
void writeDescribedType(ProtonBuffer buffer, EncoderState state, DescribedType value) throws EncodeException Write aDescribedType
type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write the proper type encoding for the providedObject
to the given buffer if anTypeEncoder
can be found for it in the collection of registered type encoders..- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write the given array as with the proper array type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write the given array as with the proper array type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write the given array as with the proper array type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write the given array as with the proper array type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write the given array as with the proper array type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write the given array as with the proper array type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write the given array as with the proper array type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write the given array as with the proper array type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write the given array as with the proper array type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write the given array as with the proper array type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write the given array as with the proper array type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write the given array as with the proper array type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write the given array as with the proper array type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
void writeArray(ProtonBuffer buffer, EncoderState state, UnsignedByte[] value) throws EncodeException Write the given array as with the proper array type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
void writeArray(ProtonBuffer buffer, EncoderState state, UnsignedShort[] value) throws EncodeException Write the given array as with the proper array type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
void writeArray(ProtonBuffer buffer, EncoderState state, UnsignedInteger[] value) throws EncodeException Write the given array as with the proper array type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
void writeArray(ProtonBuffer buffer, EncoderState state, UnsignedLong[] value) throws EncodeException Write the given array as with the proper array type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Write the given array as with the proper array type encoding to the given buffer.- Parameters:
buffer
- The buffer where the write operation is targetedstate
- TheEncoderState
to 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
Register aDescribedTypeEncoder
which 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 givenObject
instance.- Type Parameters:
V
- The type that the encoder handles.- Parameters:
encoder
- A newDescribedTypeEncoder
that will be used when encoding its matching type.- Returns:
- this
Encoder
instance. - Throws:
EncodeException
- if an error occurs while adding the encoder to the registry.
-
getTypeEncoder
Lookup aTypeEncoder
that would be used to encode the givenObject
.- Parameters:
value
- The value which should be used to resolve theTypeEncoder
that encodes it.- Returns:
- the matching
TypeEncoder
for the given value or null if no match found.
-
getTypeEncoder
Lookup aTypeEncoder
that would be used to encode the givenClass
.- Parameters:
typeClass
- TheClass
which should be used to resolve theTypeEncoder
that encodes it.- Returns:
- the matching
TypeEncoder
for the given value or null if no match found.
-