Class OutputStreamOptions

  • All Implemented Interfaces:

    public class OutputStreamOptions
    extends java.lang.Object
    implements java.lang.Cloneable
    Options class that controls various aspects of a OutputStream instance created to write the contents of a section of a StreamSenderMessage.
    • Field Detail


        public static final boolean DEFAULT_COMPLETE_SEND_ON_CLOSE
        Defines the default value for the complete parent StreamSenderMessage on close option
        See Also:
        Constant Field Values
    • Constructor Detail

      • OutputStreamOptions

        public OutputStreamOptions()
        Creates a OutputStreamOptions instance with default values for all options
    • Method Detail

      • bodyLength

        public int bodyLength()
        the configured stream size limit for associated OutputStream
      • bodyLength

        public OutputStreamOptions bodyLength​(int streamSize)
        Sets the overall stream size for this associated OutputStream that the options are applied to.

        When set this option indicates the number of bytes that can be written to the stream before an error would be thrown indicating that this value was exceeded. Conversely if the stream is closed before the number of bytes indicated is written the send will be aborted and an error will be thrown to the caller.

        streamSize - The fixed number of bytes that must be written in order for the stream to be complete.
        this OutputStreamOptions instance.
      • completeSendOnClose

        public boolean completeSendOnClose()
        the whether the close of the OutputStream should complete the parent StreamSenderMessage
      • completeSendOnClose

        public OutputStreamOptions completeSendOnClose​(boolean completeContextOnClose)
        Configures if the close of the OutputStream should result in a completion of the parent StreamSenderMessage (default is true). If there is a configured stream size and the OutputStream is closed the parent StreamSenderMessage will always be aborted as the send would be incomplete, but the close of an OutputStream may not always be the desired outcome. In the case the user wishes to add a Footer to the message transmitted by the StreamSenderMessage this option should be set to false and the user should complete the stream manually.
        completeContextOnClose - Should the OutputStream.close() method complete the parent StreamSenderMessage
        this OutputStreamOptions instance.