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
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA container for theLeasedByteBufferproduced by aMessageWriter. -
Method Summary
Modifier and TypeMethodDescriptionget()Returns the output produced by aMessageWriter.static MessageOutput.BufferofBuffer()Returns a newMessageOutputfor aLeasedByteBuffer.static MessageOutput.BufferofBuffer(Consumer<MessageOutput.Buffer.OptionBuilder> optionHandler) Returns a newMessageOutputfor aLeasedByteBufferwith the given options.
-
Method Details
-
ofBuffer
Returns a newMessageOutputfor aLeasedByteBuffer.- Returns:
- a new
MessageOutputfor aLeasedByteBuffer
-
ofBuffer
Returns a newMessageOutputfor aLeasedByteBufferwith the given options.- Parameters:
optionHandler- a handler that receives aMessageOutput.Buffer.OptionBuilder- Returns:
- a new
MessageOutputfor aLeasedByteBufferwith 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
-