Class BufferedContentSink

java.lang.Object
org.eclipse.jetty.io.content.BufferedContentSink
All Implemented Interfaces:
Content.Sink

public class BufferedContentSink extends Object implements 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 Details

  • Constructor Details

    • BufferedContentSink

      public BufferedContentSink(Content.Sink delegate, ByteBufferPool bufferPool, boolean direct, int maxAggregationSize, int maxBufferSize)
  • Method Details

    • write

      public void write(boolean last, ByteBuffer byteBuffer, Callback callback)
      Description copied from interface: Content.Sink

      Writes the given ByteBuffer, notifying the Callback 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 interface Content.Sink
      Parameters:
      last - whether the ByteBuffer is the last to write
      byteBuffer - the ByteBuffer to write
      callback - the callback to notify when the write operation is complete
    • flush

      public void flush(Callback callback)
      Flush the buffered content.
      Parameters:
      callback - Callback completed when the flush is complete