org.apache.tomcat.util.net

## Class WriteBuffer

- java.lang.Object
- - org.apache.tomcat.util.net.WriteBuffer

-     public class WriteBuffer
      extends Object

  Provides an expandable set of buffers for writes. Non-blocking writes can be of any size and may not be able to be written immediately or wholly contained in the buffer used to perform the writes to the next layer. This class provides a buffering capability to allow such writes to return immediately and also allows for the user provided buffers to be re-used / recycled as required.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `WriteBuffer.Sink` Interface implemented by clients of the WriteBuffer to enable data to be written back out from the buffer.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WriteBuffer(int bufferSize)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(ByteBuffer from)`
    `boolean` | `isEmpty()`
    `boolean` | `write(WriteBuffer.Sink sink, boolean blocking)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### WriteBuffer

          public WriteBuffer(int bufferSize)

  - ### Method Detail

    - #### add

          public void add(ByteBuffer from)

    - #### isEmpty

          public boolean isEmpty()

    - #### write

          public boolean write(WriteBuffer.Sink sink,
                      boolean blocking)
                        throws IOException

      Throws:
        `IOException`

Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.