Package org.eclipse.jetty.io.content
Class BufferedContentSink
java.lang.Object
org.eclipse.jetty.io.content.BufferedContentSink
- All Implemented Interfaces:
Content.Sink
A Content.Sink
backed by another Content.Sink
.
Any content written to this Content.Sink
is buffered,
then written to the delegate using
Content.Sink.write(boolean, ByteBuffer, Callback)
.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionBufferedContentSink
(Content.Sink delegate, ByteBufferPool bufferPool, boolean direct, int maxAggregationSize, int maxBufferSize) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Flush the buffered content.void
write
(boolean last, ByteBuffer byteBuffer, Callback callback) Writes the givenByteBuffer
, notifying theCallback
when the write is complete.
-
Field Details
-
FLUSH_BUFFER
-
-
Constructor Details
-
BufferedContentSink
public BufferedContentSink(Content.Sink delegate, ByteBufferPool bufferPool, boolean direct, int maxAggregationSize, int maxBufferSize)
-
-
Method Details
-
write
Description copied from interface:Content.Sink
Writes the given
ByteBuffer
, notifying theCallback
when the write is complete.Implementations guarantee that calls to this method are safely reentrant so that stack overflows are avoided in the case of mutual recursion between the execution of the
Callback
and a call to this method.- Specified by:
write
in interfaceContent.Sink
- Parameters:
last
- whether the ByteBuffer is the last to writebyteBuffer
- the ByteBuffer to writecallback
- the callback to notify when the write operation is complete
-
flush
Flush the buffered content.- Parameters:
callback
- Callback completed when the flush is complete
-