Class ProtonEncoder

java.lang.Object
org.apache.qpid.protonj2.codec.encoders.ProtonEncoder
All Implemented Interfaces:
Encoder

public final class ProtonEncoder extends Object implements Encoder
The default AMQP Encoder implementation.
  • Constructor Details

    • ProtonEncoder

      public ProtonEncoder()
  • Method Details

    • newEncoderState

      public ProtonEncoderState newEncoderState()
      Description copied from interface: Encoder
      Creates a new EncoderState instance that can be used when interacting with the Encoder. For encoding that occurs on more than one thread while sharing a single Encoder instance a different state object per thread is required as the EncoderState 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 the Encoder offers a utility cached EncoderState API that will return the same instance on each call which can reduce allocation overhead and make using the Encoder simpler.
      Specified by:
      newEncoderState in interface Encoder
      Returns:
      a newly constructed EncoderState instance.
    • getCachedEncoderState

      public ProtonEncoderState getCachedEncoderState()
      Description copied from interface: Encoder
      Return a singleton EncoderState instance that is meant to be shared within single threaded encoder interactions. If more than one thread makes use of this cache EncoderState 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.
      Specified by:
      getCachedEncoderState in interface Encoder
      Returns:
      a cached EncoderState linked to this Encoder instance.
    • writeNull

      public void writeNull(ProtonBuffer buffer, EncoderState state) throws EncodeException
      Description copied from interface: Encoder
      Write a Null type encoding to the given buffer.
      Specified by:
      writeNull in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState to 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: Encoder
      Write a Boolean type encoding to the given buffer.
      Specified by:
      writeBoolean in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeBoolean(ProtonBuffer buffer, EncoderState state, Boolean value) throws EncodeException
      Description copied from interface: Encoder
      Write a Boolean type encoding to the given buffer.
      Specified by:
      writeBoolean in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeUnsignedByte(ProtonBuffer buffer, EncoderState state, UnsignedByte value) throws EncodeException
      Description copied from interface: Encoder
      Write an UnsignedByte type encoding to the given buffer.
      Specified by:
      writeUnsignedByte in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeUnsignedByte(ProtonBuffer buffer, EncoderState state, byte value) throws EncodeException
      Description copied from interface: Encoder
      Write an UnsignedByte type encoding to the given buffer.
      Specified by:
      writeUnsignedByte in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeUnsignedShort(ProtonBuffer buffer, EncoderState state, UnsignedShort value) throws EncodeException
      Description copied from interface: Encoder
      Write a UnsignedShort type encoding to the given buffer.
      Specified by:
      writeUnsignedShort in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeUnsignedShort(ProtonBuffer buffer, EncoderState state, short value) throws EncodeException
      Description copied from interface: Encoder
      Write a UnsignedShort type encoding to the given buffer.
      Specified by:
      writeUnsignedShort in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeUnsignedShort(ProtonBuffer buffer, EncoderState state, int value) throws EncodeException
      Description copied from interface: Encoder
      Write a UnsignedShort type encoding to the given buffer using the provided value with appropriate range checks to ensure invalid input is not accepted.
      Specified by:
      writeUnsignedShort in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeUnsignedInteger(ProtonBuffer buffer, EncoderState state, UnsignedInteger value) throws EncodeException
      Description copied from interface: Encoder
      Write a UnsignedInteger type encoding to the given buffer.
      Specified by:
      writeUnsignedInteger in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeUnsignedInteger(ProtonBuffer buffer, EncoderState state, byte value) throws EncodeException
      Description copied from interface: Encoder
      Write a UnsignedInteger type encoding to the given buffer.
      Specified by:
      writeUnsignedInteger in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeUnsignedInteger(ProtonBuffer buffer, EncoderState state, int value) throws EncodeException
      Description copied from interface: Encoder
      Write a UnsignedInteger type encoding to the given buffer.
      Specified by:
      writeUnsignedInteger in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeUnsignedInteger(ProtonBuffer buffer, EncoderState state, long value) throws EncodeException
      Description copied from interface: Encoder
      Write a UnsignedInteger type encoding to the given buffer using the provided value with appropriate range checks to ensure invalid input is not accepted.
      Specified by:
      writeUnsignedInteger in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeUnsignedLong(ProtonBuffer buffer, EncoderState state, byte value) throws EncodeException
      Description copied from interface: Encoder
      Write a UnsignedLong type encoding to the given buffer.
      Specified by:
      writeUnsignedLong in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeUnsignedLong(ProtonBuffer buffer, EncoderState state, long value) throws EncodeException
      Description copied from interface: Encoder
      Write a UnsignedLong type encoding to the given buffer.
      Specified by:
      writeUnsignedLong in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeUnsignedLong(ProtonBuffer buffer, EncoderState state, UnsignedLong value) throws EncodeException
      Description copied from interface: Encoder
      Write a UnsignedLong type encoding to the given buffer.
      Specified by:
      writeUnsignedLong in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeByte(ProtonBuffer buffer, EncoderState state, byte value) throws EncodeException
      Description copied from interface: Encoder
      Write a Byte type encoding to the given buffer.
      Specified by:
      writeByte in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeByte(ProtonBuffer buffer, EncoderState state, Byte value) throws EncodeException
      Description copied from interface: Encoder
      Write a Byte type encoding to the given buffer.
      Specified by:
      writeByte in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeShort(ProtonBuffer buffer, EncoderState state, short value) throws EncodeException
      Description copied from interface: Encoder
      Write a Short type encoding to the given buffer.
      Specified by:
      writeShort in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeShort(ProtonBuffer buffer, EncoderState state, Short value) throws EncodeException
      Description copied from interface: Encoder
      Write a Short type encoding to the given buffer.
      Specified by:
      writeShort in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeInteger(ProtonBuffer buffer, EncoderState state, int value) throws EncodeException
      Description copied from interface: Encoder
      Write a Integer type encoding to the given buffer.
      Specified by:
      writeInteger in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeInteger(ProtonBuffer buffer, EncoderState state, Integer value) throws EncodeException
      Description copied from interface: Encoder
      Write a Integer type encoding to the given buffer.
      Specified by:
      writeInteger in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeLong(ProtonBuffer buffer, EncoderState state, long value) throws EncodeException
      Description copied from interface: Encoder
      Write a Long type encoding to the given buffer.
      Specified by:
      writeLong in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeLong(ProtonBuffer buffer, EncoderState state, Long value) throws EncodeException
      Description copied from interface: Encoder
      Write a Long type encoding to the given buffer.
      Specified by:
      writeLong in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeFloat(ProtonBuffer buffer, EncoderState state, float value) throws EncodeException
      Description copied from interface: Encoder
      Write a Float type encoding to the given buffer.
      Specified by:
      writeFloat in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeFloat(ProtonBuffer buffer, EncoderState state, Float value) throws EncodeException
      Description copied from interface: Encoder
      Write a Float type encoding to the given buffer.
      Specified by:
      writeFloat in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeDouble(ProtonBuffer buffer, EncoderState state, double value) throws EncodeException
      Description copied from interface: Encoder
      Write a Double type encoding to the given buffer.
      Specified by:
      writeDouble in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeDouble(ProtonBuffer buffer, EncoderState state, Double value) throws EncodeException
      Description copied from interface: Encoder
      Write a Double type encoding to the given buffer.
      Specified by:
      writeDouble in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeDecimal32(ProtonBuffer buffer, EncoderState state, Decimal32 value) throws EncodeException
      Description copied from interface: Encoder
      Write a Decimal32 type encoding to the given buffer.
      Specified by:
      writeDecimal32 in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeDecimal64(ProtonBuffer buffer, EncoderState state, Decimal64 value) throws EncodeException
      Description copied from interface: Encoder
      Write a Decimal64 type encoding to the given buffer.
      Specified by:
      writeDecimal64 in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeDecimal128(ProtonBuffer buffer, EncoderState state, Decimal128 value) throws EncodeException
      Description copied from interface: Encoder
      Write a Decimal128 type encoding to the given buffer.
      Specified by:
      writeDecimal128 in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeCharacter(ProtonBuffer buffer, EncoderState state, char value) throws EncodeException
      Description copied from interface: Encoder
      Write a Character type encoding to the given buffer.
      Specified by:
      writeCharacter in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeCharacter(ProtonBuffer buffer, EncoderState state, Character value) throws EncodeException
      Description copied from interface: Encoder
      Write a Character type encoding to the given buffer.
      Specified by:
      writeCharacter in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeTimestamp(ProtonBuffer buffer, EncoderState state, long value) throws EncodeException
      Description copied from interface: Encoder
      Write a Time stamp type encoding to the given buffer.
      Specified by:
      writeTimestamp in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeTimestamp(ProtonBuffer buffer, EncoderState state, Date value) throws EncodeException
      Description copied from interface: Encoder
      Write a Time stamp type encoding to the given buffer.
      Specified by:
      writeTimestamp in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeUUID(ProtonBuffer buffer, EncoderState state, UUID value) throws EncodeException
      Description copied from interface: Encoder
      Write a UUID type encoding to the given buffer.
      Specified by:
      writeUUID in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeBinary(ProtonBuffer buffer, EncoderState state, Binary value) throws EncodeException
      Description copied from interface: Encoder
      Writes the contents of the given Binary value into the provided 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.

      Specified by:
      writeBinary in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeBinary(ProtonBuffer buffer, EncoderState state, ProtonBuffer value) throws EncodeException
      Description copied from interface: Encoder
      Writes the contents of the given ProtonBuffer value into the provided ProtonBuffer 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.

      Specified by:
      writeBinary in interface Encoder
      Parameters:
      buffer - the target buffer where the binary value is to be encoded
      state - the EncoderState instance that manages the calling threads state tracking.
      value - the ProtonBuffer value 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: Encoder
      Writes the contents of the given byte value into the provided 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.

      Specified by:
      writeBinary in interface Encoder
      Parameters:
      buffer - the target buffer where the binary value is to be encoded
      state - the EncoderState instance that manages the calling threads state tracking.
      value - the ProtonBuffer value 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: Encoder
      Writes the contents of the given DeliveryTag value into the provided 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.

      Specified by:
      writeDeliveryTag in interface Encoder
      Parameters:
      buffer - the target buffer where the binary value is to be encoded
      state - the EncoderState instance that manages the calling threads state tracking.
      value - the DeliveryTag value 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: Encoder
      Write a String type encoding to the given buffer.
      Specified by:
      writeString in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeSymbol(ProtonBuffer buffer, EncoderState state, Symbol value) throws EncodeException
      Description copied from interface: Encoder
      Write a Symbol type encoding to the given buffer.
      Specified by:
      writeSymbol in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeSymbol(ProtonBuffer buffer, EncoderState state, String value) throws EncodeException
      Description copied from interface: Encoder
      Write a Symbol type encoding to the given buffer. The provided String instance should contain only ASCII characters and the encoder should throw an EncodeException if a non-ASCII character is encountered.
      Specified by:
      writeSymbol in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public <T> void writeList(ProtonBuffer buffer, EncoderState state, List<T> value) throws EncodeException
      Description copied from interface: Encoder
      Write a List type encoding to the given buffer.
      Specified by:
      writeList in interface Encoder
      Type Parameters:
      T - The type that comprises the List entries.
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public <K, V> void writeMap(ProtonBuffer buffer, EncoderState state, Map<K,V> value) throws EncodeException
      Description copied from interface: Encoder
      Write a Map type encoding to the given buffer.
      Specified by:
      writeMap in interface Encoder
      Type Parameters:
      K - the type that comprises the Map keys.
      V - the type that comprises the Map values.
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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.
    • writeDescribedType

      public void writeDescribedType(ProtonBuffer buffer, EncoderState state, DescribedType value) throws EncodeException
      Description copied from interface: Encoder
      Write a DescribedType type encoding to the given buffer.
      Specified by:
      writeDescribedType in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeArray(ProtonBuffer buffer, EncoderState state, boolean[] value) throws EncodeException
      Description copied from interface: Encoder
      Write the given array as with the proper array type encoding to the given buffer.
      Specified by:
      writeArray in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeArray(ProtonBuffer buffer, EncoderState state, byte[] value) throws EncodeException
      Description copied from interface: Encoder
      Write the given array as with the proper array type encoding to the given buffer.
      Specified by:
      writeArray in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeArray(ProtonBuffer buffer, EncoderState state, short[] value) throws EncodeException
      Description copied from interface: Encoder
      Write the given array as with the proper array type encoding to the given buffer.
      Specified by:
      writeArray in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeArray(ProtonBuffer buffer, EncoderState state, int[] value) throws EncodeException
      Description copied from interface: Encoder
      Write the given array as with the proper array type encoding to the given buffer.
      Specified by:
      writeArray in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeArray(ProtonBuffer buffer, EncoderState state, long[] value) throws EncodeException
      Description copied from interface: Encoder
      Write the given array as with the proper array type encoding to the given buffer.
      Specified by:
      writeArray in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeArray(ProtonBuffer buffer, EncoderState state, float[] value) throws EncodeException
      Description copied from interface: Encoder
      Write the given array as with the proper array type encoding to the given buffer.
      Specified by:
      writeArray in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeArray(ProtonBuffer buffer, EncoderState state, double[] value) throws EncodeException
      Description copied from interface: Encoder
      Write the given array as with the proper array type encoding to the given buffer.
      Specified by:
      writeArray in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeArray(ProtonBuffer buffer, EncoderState state, char[] value) throws EncodeException
      Description copied from interface: Encoder
      Write the given array as with the proper array type encoding to the given buffer.
      Specified by:
      writeArray in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeArray(ProtonBuffer buffer, EncoderState state, Object[] value) throws EncodeException
      Description copied from interface: Encoder
      Write the given array as with the proper array type encoding to the given buffer.
      Specified by:
      writeArray in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeArray(ProtonBuffer buffer, EncoderState state, Decimal32[] value) throws EncodeException
      Description copied from interface: Encoder
      Write the given array as with the proper array type encoding to the given buffer.
      Specified by:
      writeArray in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeArray(ProtonBuffer buffer, EncoderState state, Decimal64[] value) throws EncodeException
      Description copied from interface: Encoder
      Write the given array as with the proper array type encoding to the given buffer.
      Specified by:
      writeArray in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeArray(ProtonBuffer buffer, EncoderState state, Decimal128[] value) throws EncodeException
      Description copied from interface: Encoder
      Write the given array as with the proper array type encoding to the given buffer.
      Specified by:
      writeArray in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeArray(ProtonBuffer buffer, EncoderState state, Symbol[] value) throws EncodeException
      Description copied from interface: Encoder
      Write the given array as with the proper array type encoding to the given buffer.
      Specified by:
      writeArray in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeArray(ProtonBuffer buffer, EncoderState state, UnsignedByte[] value) throws EncodeException
      Description copied from interface: Encoder
      Write the given array as with the proper array type encoding to the given buffer.
      Specified by:
      writeArray in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeArray(ProtonBuffer buffer, EncoderState state, UnsignedShort[] value) throws EncodeException
      Description copied from interface: Encoder
      Write the given array as with the proper array type encoding to the given buffer.
      Specified by:
      writeArray in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeArray(ProtonBuffer buffer, EncoderState state, UnsignedInteger[] value) throws EncodeException
      Description copied from interface: Encoder
      Write the given array as with the proper array type encoding to the given buffer.
      Specified by:
      writeArray in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeArray(ProtonBuffer buffer, EncoderState state, UnsignedLong[] value) throws EncodeException
      Description copied from interface: Encoder
      Write the given array as with the proper array type encoding to the given buffer.
      Specified by:
      writeArray in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeArray(ProtonBuffer buffer, EncoderState state, UUID[] value) throws EncodeException
      Description copied from interface: Encoder
      Write the given array as with the proper array type encoding to the given buffer.
      Specified by:
      writeArray in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public void writeObject(ProtonBuffer buffer, EncoderState state, Object value) throws EncodeException
      Description copied from interface: Encoder
      Write the proper type encoding for the provided Object to the given buffer if an TypeEncoder can be found for it in the collection of registered type encoders..
      Specified by:
      writeObject in interface Encoder
      Parameters:
      buffer - The buffer where the write operation is targeted
      state - The EncoderState 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

      public <V> ProtonEncoder registerDescribedTypeEncoder(DescribedTypeEncoder<V> encoder)
      Description copied from interface: Encoder
      Register a DescribedTypeEncoder 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 given Object instance.
      Specified by:
      registerDescribedTypeEncoder in interface Encoder
      Type Parameters:
      V - The type that the encoder handles.
      Parameters:
      encoder - A new DescribedTypeEncoder that will be used when encoding its matching type.
      Returns:
      this Encoder instance.
    • getTypeEncoder

      public TypeEncoder<?> getTypeEncoder(Object value)
      Description copied from interface: Encoder
      Lookup a TypeEncoder that would be used to encode the given Object.
      Specified by:
      getTypeEncoder in interface Encoder
      Parameters:
      value - The value which should be used to resolve the TypeEncoder that encodes it.
      Returns:
      the matching TypeEncoder for the given value or null if no match found.
    • getTypeEncoder

      public TypeEncoder<?> getTypeEncoder(Class<?> typeClass)
      Description copied from interface: Encoder
      Lookup a TypeEncoder that would be used to encode the given Class.
      Specified by:
      getTypeEncoder in interface Encoder
      Parameters:
      typeClass - The Class which should be used to resolve the TypeEncoder that encodes it.
      Returns:
      the matching TypeEncoder for the given value or null if no match found.
    • getTypeEncoder

      public TypeEncoder<?> getTypeEncoder(Class<?> typeClass, Object instance)
      Lookup a TypeEncoder by first checking the given type Class and then if none found to deduce a valid TypeEncoder from the Object specified.
      Parameters:
      typeClass - The Class for which a type specific encoder is requested.
      instance - An Object instance to use as a fall back if no encoder found for the Class
      Returns:
      a TypeEncoder if a match to the given query is found or null of non can be deduced.