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 ofByteBuffer
.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 Description protected
BufferedData(int bufferSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BufferedData
allocate(int bufferSize)
int
capacity()
Returns available capacity of this buffer.void
clear()
Clears buffer.java.nio.ByteBuffer
data()
boolean
hasData()
Determines if the buffer contains data.int
length()
Returns the length of this buffer.void
put(java.nio.ByteBuffer src)
int
readFrom(java.nio.channels.ReadableByteChannel channel)
int
writeTo(java.nio.channels.WritableByteChannel dst)
-
Methods inherited from class org.apache.hc.core5.http.impl.nio.ExpandableBuffer
buffer, ensureAdjustedCapacity, ensureCapacity, expand, mode, setInputMode, setOutputMode, toString
-
-
-
-
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 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
public final void put(java.nio.ByteBuffer src)
-
readFrom
public final int readFrom(java.nio.channels.ReadableByteChannel channel) throws java.io.IOException
- Throws:
java.io.IOException
-
writeTo
public final int writeTo(java.nio.channels.WritableByteChannel dst) throws java.io.IOException
- Throws:
java.io.IOException
-
data
public final java.nio.ByteBuffer data()
-
-