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 BufferedDataallocate(int bufferSize) final intcapacity()Returns available capacity of this buffer.final voidclear()Clears buffer.final ByteBufferdata()final booleanhasData()Determines if the buffer contains data.final intlength()Returns the length of this buffer.final voidput(ByteBuffer src) final intreadFrom(ReadableByteChannel channel) final intMethods 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:ExpandableBufferDetermines if the buffer contains data.Sets the mode to output.
- Overrides:
hasDatain classExpandableBuffer- Returns:
trueif there is data in the buffer,falseotherwise.
-
length
public final int length()Description copied from class:ExpandableBufferReturns the length of this buffer.Sets the mode to output.
- Overrides:
lengthin classExpandableBuffer- Returns:
- buffer length.
-
capacity
public final int capacity()Description copied from class:ExpandableBufferReturns available capacity of this buffer.- Overrides:
capacityin classExpandableBuffer- Returns:
- buffer length.
-
clear
public final void clear()Description copied from class:ExpandableBufferClears buffer.Sets the mode to input.
- Overrides:
clearin classExpandableBuffer
-
put
-
readFrom
- Throws:
IOException
-
writeTo
- Throws:
IOException
-
data
-