Package org.apache.qpid.protonj2.client
Class DecodeOptions
java.lang.Object
org.apache.qpid.protonj2.client.DecodeOptions
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic DecodeOptionsCreates and returns a default decode options instance.intGets 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 aDecodeExceptionis 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.intGets 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.
-
Constructor Details
-
DecodeOptions
public DecodeOptions()
-
-
Method Details
-
defaultOptions
Creates and returns a default decode options instance.- Returns:
- a new
DecodeOptionsinstance 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
Sets the configured maximum depth that nested types such as Lists, Maps and Arrays can have before aDecodeExceptionis 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
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
DecodeOptionsinstance for chaining.
-