Class BufferedData
java.lang.Object
org.apache.hc.core5.http.impl.nio.ExpandableBuffer
org.apache.hc.core5.http.impl.nio.BufferedData
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedData
allocate
(int bufferSize) final int
capacity()
Returns available capacity of this buffer.final void
clear()
Clears buffer.final ByteBuffer
data()
final boolean
hasData()
Determines if the buffer contains data.final int
length()
Returns the length of this buffer.final void
put
(ByteBuffer src) final int
readFrom
(ReadableByteChannel channel) final int
Methods inherited from class org.apache.hc.core5.http.impl.nio.ExpandableBuffer
buffer, ensureAdjustedCapacity, ensureCapacity, expand, mode, setInputMode, setOutputMode, toString
-
Constructor Details
-
BufferedData
protected BufferedData(int bufferSize)
-
-
Method Details
-
allocate
-
hasData
public final boolean hasData()Description copied from class:ExpandableBuffer
Determines if the buffer contains data.Sets the mode to output.
- Overrides:
hasData
in classExpandableBuffer
- 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 classExpandableBuffer
- Returns:
- buffer length.
-
capacity
public final int capacity()Description copied from class:ExpandableBuffer
Returns available capacity of this buffer.- Overrides:
capacity
in classExpandableBuffer
- Returns:
- buffer length.
-
clear
public final void clear()Description copied from class:ExpandableBuffer
Clears buffer.Sets the mode to input.
- Overrides:
clear
in classExpandableBuffer
-
put
-
readFrom
- Throws:
IOException
-
writeTo
- Throws:
IOException
-
data
-