Class DecodeOptions

java.lang.Object
org.apache.qpid.protonj2.client.DecodeOptions

public final class DecodeOptions extends Object
Configuration options that can be passed to the Delivery APIs for reading messages and delivery annotations to give access to certain options that can influence certain behaviors of the AMQP decoder that reads the bytes associated with the incoming delivery.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates and returns a default decode options instance.
    int
    Gets the currently configured decode depth limit that will be enforced when decoding AMQP types, if the encoding nests deeper than the configured limit an exception will be thrown.
    depthLimit(int depthLimit)
    Sets the configured maximum depth that nested types such as Lists, Maps and Arrays can have before a DecodeException is thrown to allow the decoder to error in cases where the depth of encoding exceeds what the environment is thought to be able to support.
    int
    Gets the configured maximum number of elements that can be decoded from an array encoded with the zero width AMQP types (Null, UInt0.
    maxZeroWidthArrayElements(int maxElements)
    Sets the configured maximum number of elements that can be decoded from an array encoded with the zero width AMQP types (Null, UInt0.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DecodeOptions

      public DecodeOptions()
  • Method Details

    • defaultOptions

      public static DecodeOptions defaultOptions()
      Creates and returns a default decode options instance.
      Returns:
      a new DecodeOptions instance configured with defaults.
    • depthLimit

      public int depthLimit()
      Gets the currently configured decode depth limit that will be enforced when decoding AMQP types, if the encoding nests deeper than the configured limit an exception will be thrown.
      Returns:
      the currently configured decode depth limit
    • depthLimit

      public DecodeOptions depthLimit(int depthLimit)
      Sets the configured maximum depth that nested types such as Lists, Maps and Arrays can have before a DecodeException is thrown to allow the decoder to error in cases where the depth of encoding exceeds what the environment is thought to be able to support.
      Parameters:
      depthLimit - The configured limit on decoding types with nested element structures.
      Throws:
      DecodeException - if a set decoding depth limit is exceeded.
    • maxZeroWidthArrayElements

      public int maxZeroWidthArrayElements()
      Gets the configured maximum number of elements that can be decoded from an array encoded with the zero width AMQP types (Null, UInt0. ULong0, List0, Boolean_False and Boolean_True). A return value of zero indicates that the decoder should throw if any array with zero width encodings is encountered.
      Returns:
      the configured max number of zero width array encoding elements.
    • maxZeroWidthArrayElements

      public DecodeOptions maxZeroWidthArrayElements(int maxElements)
      Sets the configured maximum number of elements that can be decoded from an array encoded with the zero width AMQP types (Null, UInt0. ULong0, List0, Boolean_False and Boolean_True). These are uncommon encodings and can lead to small encodings with large memory costs at decode which makes them discouraged for normal use.

      It is recommended that for implementations that implement this limit configuration the default be zero meaning zero width array encodings are disabled and will always throw a DecodeException

      Parameters:
      maxElements - The configured max elements allowed in arrays encoded for zero width types.
      Returns:
      this DecodeOptions instance for chaining.