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 protectedBufferedData(int bufferSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BufferedDataallocate(int bufferSize)intcapacity()Returns available capacity of this buffer.voidclear()Clears buffer.java.nio.ByteBufferdata()booleanhasData()Determines if the buffer contains data.intlength()Returns the length of this buffer.voidput(java.nio.ByteBuffer src)intreadFrom(java.nio.channels.ReadableByteChannel channel)intwriteTo(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: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
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()
-
-