Interface MessageOutput<T>
- Type Parameters:
T
- the type of output produced
- All Known Subinterfaces:
MessageOutput.Buffer
A container for the in-memory output produced by a MessageWriter
.
To create a MessageOutput
, call one of its ofXxx
methods.
To pass the MessageOutput
to a message writer, call MessageWriter.of(java.nio.channels.WritableByteChannel)
.
To obtain the produced output, call get()
after the message writer has been closed.
Producing in-memory output requires buffer copying.
For best performance, use a message writer that writes to
a WritableByteChannel
or OutputStream
.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
A container for theLeasedByteBuffer
produced by aMessageWriter
. -
Method Summary
Modifier and TypeMethodDescriptionget()
Returns the output produced by aMessageWriter
.static MessageOutput.Buffer
ofBuffer()
Returns a newMessageOutput
for aLeasedByteBuffer
.static MessageOutput.Buffer
ofBuffer
(Consumer<MessageOutput.Buffer.OptionBuilder> optionHandler) Returns a newMessageOutput
for aLeasedByteBuffer
with the given options.
-
Method Details
-
ofBuffer
Returns a newMessageOutput
for aLeasedByteBuffer
.- Returns:
- a new
MessageOutput
for aLeasedByteBuffer
-
ofBuffer
Returns a newMessageOutput
for aLeasedByteBuffer
with the given options.- Parameters:
optionHandler
- a handler that receives aMessageOutput.Buffer.OptionBuilder
- Returns:
- a new
MessageOutput
for aLeasedByteBuffer
with the given options
-
get
T get()Returns the output produced by aMessageWriter
.- Returns:
- the output produced by a
MessageWriter
- Throws:
IllegalStateException
- if this method is called before the message writer has been closed
-