Package org.apache.qpid.protonj2.client
Class OutputStreamOptions
- java.lang.Object
-
- org.apache.qpid.protonj2.client.OutputStreamOptions
-
public class OutputStreamOptions extends java.lang.Object
Options class that controls various aspects of aOutputStream
instance created to write the contents of a section of aStreamSenderMessage
.
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEFAULT_COMPLETE_SEND_ON_CLOSE
Defines the default value for the complete parentStreamSenderMessage
on close option
-
Constructor Summary
Constructors Constructor Description OutputStreamOptions()
Creates aOutputStreamOptions
instance with default values for all optionsOutputStreamOptions(OutputStreamOptions options)
Create aOutputStreamOptions
instance that copies all configuration from the givenOutputStreamOptions
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
bodyLength()
OutputStreamOptions
bodyLength(int streamSize)
Sets the overall stream size for this associatedOutputStream
that the options are applied to.OutputStreamOptions
clone()
boolean
completeSendOnClose()
OutputStreamOptions
completeSendOnClose(boolean completeContextOnClose)
Configures if the close of theOutputStream
should result in a completion of the parentStreamSenderMessage
(default is true).protected OutputStreamOptions
copyInto(OutputStreamOptions other)
Copy all options from thisOutputStreamOptions
instance into the instance provided.
-
-
-
Field Detail
-
DEFAULT_COMPLETE_SEND_ON_CLOSE
public static final boolean DEFAULT_COMPLETE_SEND_ON_CLOSE
Defines the default value for the complete parentStreamSenderMessage
on close option- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OutputStreamOptions
public OutputStreamOptions()
Creates aOutputStreamOptions
instance with default values for all options
-
OutputStreamOptions
public OutputStreamOptions(OutputStreamOptions options)
Create aOutputStreamOptions
instance that copies all configuration from the givenOutputStreamOptions
instance.- Parameters:
options
- The options instance to copy all configuration values from.
-
-
Method Detail
-
clone
public OutputStreamOptions clone()
- Overrides:
clone
in classjava.lang.Object
-
copyInto
protected OutputStreamOptions copyInto(OutputStreamOptions other)
Copy all options from thisOutputStreamOptions
instance into the instance provided.- Parameters:
other
- the target of this copy operation.- Returns:
- this
OutputStreamOptions
class for chaining.
-
bodyLength
public int bodyLength()
- Returns:
- the configured stream size limit for associated
OutputStream
-
bodyLength
public OutputStreamOptions bodyLength(int streamSize)
Sets the overall stream size for this associatedOutputStream
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.
- Parameters:
streamSize
- The fixed number of bytes that must be written in order for the stream to be complete.- Returns:
- this
OutputStreamOptions
instance.
-
completeSendOnClose
public boolean completeSendOnClose()
- Returns:
- the whether the close of the
OutputStream
should complete the parentStreamSenderMessage
-
completeSendOnClose
public OutputStreamOptions completeSendOnClose(boolean completeContextOnClose)
Configures if the close of theOutputStream
should result in a completion of the parentStreamSenderMessage
(default is true). If there is a configured stream size and theOutputStream
is closed the parentStreamSenderMessage
will always be aborted as the send would be incomplete, but the close of anOutputStream
may not always be the desired outcome. In the case the user wishes to add aFooter
to the message transmitted by theStreamSenderMessage
this option should be set to false and the user should complete the stream manually.- Parameters:
completeContextOnClose
- Should theOutputStream.close()
method complete the parentStreamSenderMessage
- Returns:
- this
OutputStreamOptions
instance.
-
-