org.apache.hc.core5.http.impl.nio

## Class BufferedData

- java.lang.Object
- - org.apache.hc.core5.http.impl.nio.ExpandableBuffer
  - - org.apache.hc.core5.http.impl.nio.BufferedData

-     public class BufferedData
      extends ExpandableBuffer

  A buffer that expand its capacity on demand. Internally, this class is backed by an instance of `ByteBuffer`.

  This class is not thread safe.

  Since:
    5.0

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.hc.core5.http.impl.nio.ExpandableBuffer

      `ExpandableBuffer.Mode`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `BufferedData(int bufferSize)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static BufferedData` | `allocate(int bufferSize)`
    `int` | `capacity()` Returns available capacity of this buffer.
    `void` | `clear()` Clears buffer.
    `ByteBuffer` | `data()`
    `boolean` | `hasData()` Determines if the buffer contains data.
    `int` | `length()` Returns the length of this buffer.
    `void` | `put(ByteBuffer src)`
    `int` | `readFrom(ReadableByteChannel channel)`
    `int` | `writeTo(WritableByteChannel dst)`

    - ### Methods inherited from class org.apache.hc.core5.http.impl.nio.ExpandableBuffer

      `buffer, ensureAdjustedCapacity, ensureCapacity, expand, mode, setInputMode, setOutputMode, toString`

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

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

- - ### Constructor Detail

    - #### BufferedData

          protected BufferedData(int bufferSize)

  - ### Method Detail

    - #### allocate

          public static BufferedData allocate(int bufferSize)

    - #### hasData

          public final boolean hasData()

      Description copied from class: `ExpandableBuffer`
      Determines if the buffer contains data.

      Sets the mode to output.

      Overrides:
        `hasData` in class `ExpandableBuffer`
      Returns:
        `true` if there is data in the buffer, `false` otherwise.

    - #### length

          public final int length()

      Description copied from class: `ExpandableBuffer`
      Returns the length of this buffer.

      Sets the mode to output.

      Overrides:
        `length` in class `ExpandableBuffer`
      Returns:
        buffer length.

    - #### capacity

          public final int capacity()

      Description copied from class: `ExpandableBuffer`
      Returns available capacity of this buffer.
      Overrides:
        `capacity` in class `ExpandableBuffer`
      Returns:
        buffer length.

    - #### clear

          public final void clear()

      Description copied from class: `ExpandableBuffer`
      Clears buffer.

      Sets the mode to input.

      Overrides:
        `clear` in class `ExpandableBuffer`

    - #### put

          public final void put(ByteBuffer src)

    - #### readFrom

          public final int readFrom(ReadableByteChannel channel)
                             throws IOException

      Throws:
        `IOException`

    - #### writeTo

          public final int writeTo(WritableByteChannel dst)
                            throws IOException

      Throws:
        `IOException`

    - #### data

          public final ByteBuffer data()

Copyright © 2005–2022 The Apache Software Foundation. All rights reserved.