Class StreamDecodeOptions

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

public final class StreamDecodeOptions extends Object
Configuration options that can be passed to the StreamDelivery 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 a default StreamDecodeOptions instance configured with the client defied defaults for all values.
    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 size of an encoded array this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
    maxArraySize(int maximumSize)
    Sets the configured maximum size of an encoded array this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
    int
    Gets the configured maximum length of an encoded Binary this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
    maxBinarySize(int maximumSize)
    Gets the configured maximum size of an encoded Binary this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
    int
    Gets the configured maximum indicated encoded size of a List this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
    maxListSize(int maximumSize)
    Sets the configured maximum indicated encoded size of a List this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
    int
    Gets the configured maximum indicated encoded size of a List this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
    maxMapSize(int maximumSize)
    Sets the configured maximum indicated encoded size of a Map this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
    int
    Gets the configured maximum size of an encoded string this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
    maxStringSize(int maximumSize)
    Sets the configured maximum size of an encoded string this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
    int
    Gets the configured maximum size of an encoded Symbol this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
    maxSymbolSize(int maximumSize)
    Gets the configured maximum length of an encoded Symbol this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
    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

    • StreamDecodeOptions

      public StreamDecodeOptions()
  • Method Details

    • defaultOptions

      public static StreamDecodeOptions defaultOptions()
      Creates a default StreamDecodeOptions instance configured with the client defied defaults for all values.
      Returns:
      a new StreamDecodeOptions 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 StreamDecodeOptions 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 StreamDecodeOptions 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 StreamDecodeOptions instance for chaining.
    • maxStringSize

      public int maxStringSize()
      Gets the configured maximum size of an encoded string this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
      Returns:
      the configured max encoded string size supported.
    • maxStringSize

      public StreamDecodeOptions maxStringSize(int maximumSize)
      Sets the configured maximum size of an encoded string this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
      Parameters:
      maximumSize - The maximum allowed encoded size value to allow before an decoding exception is thrown.
      Returns:
      this StreamDecodeOptions instance for chaining.
    • maxArraySize

      public int maxArraySize()
      Gets the configured maximum size of an encoded array this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
      Returns:
      the configured max encoded array size supported.
    • maxArraySize

      public StreamDecodeOptions maxArraySize(int maximumSize)
      Sets the configured maximum size of an encoded array this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
      Parameters:
      maximumSize - The maximum allowed encoded size value to allow before an decoding exception is thrown.
      Returns:
      this StreamDecodeOptions instance for chaining.
    • maxListSize

      public int maxListSize()
      Gets the configured maximum indicated encoded size of a List this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
      Returns:
      the configured max encoded list elements supported.
    • maxListSize

      public StreamDecodeOptions maxListSize(int maximumSize)
      Sets the configured maximum indicated encoded size of a List this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
      Parameters:
      maximumSize - The maximum allowed encoded size value to allow before an decoding exception is thrown.
      Returns:
      this StreamDecodeOptions instance for chaining.
    • maxMapSize

      public int maxMapSize()
      Gets the configured maximum indicated encoded size of a List this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
      Returns:
      the configured max encoded list size supported.
    • maxMapSize

      public StreamDecodeOptions maxMapSize(int maximumSize)
      Sets the configured maximum indicated encoded size of a Map this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
      Parameters:
      maximumSize - The maximum allowed encoded size value to allow before an decoding exception is thrown.
      Returns:
      this StreamDecodeOptions instance for chaining.
    • maxBinarySize

      public int maxBinarySize()
      Gets the configured maximum length of an encoded Binary this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
      Returns:
      the configured max encoded binary length supported.
    • maxBinarySize

      public StreamDecodeOptions maxBinarySize(int maximumSize)
      Gets the configured maximum size of an encoded Binary this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
      Parameters:
      maximumSize - The maximum allowed encoded size value to allow before an decoding exception is thrown.
      Returns:
      this StreamDecodeOptions instance for chaining.
    • maxSymbolSize

      public int maxSymbolSize()
      Gets the configured maximum size of an encoded Symbol this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
      Returns:
      the configured max encoded Symbol length supported.
    • maxSymbolSize

      public StreamDecodeOptions maxSymbolSize(int maximumSize)
      Gets the configured maximum length of an encoded Symbol this decoder will allow before it throws an DecodeException to indicate that a rule violation has occurred.
      Parameters:
      maximumSize - The maximum allowed encoded size value to allow before an decoding exception is thrown.
      Returns:
      this StreamDecodeOptions instance for chaining.