|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.http.nio.util.ExpandableBuffer
@NotThreadSafe public class ExpandableBuffer
A buffer that expand its capacity on demand using ByteBufferAllocator
interface. Internally, this class is backed by an instance of
ByteBuffer.
This class is not thread safe.
| Field Summary | |
|---|---|
protected ByteBuffer |
buffer
|
static int |
INPUT_MODE
|
static int |
OUTPUT_MODE
|
| Constructor Summary | |
|---|---|
ExpandableBuffer(int buffersize,
ByteBufferAllocator allocator)
Allocates buffer of the given size using the given allocator. |
|
| Method Summary | |
|---|---|
int |
available()
Returns available capacity of this buffer. |
int |
capacity()
Returns the total capacity of this buffer. |
protected void |
clear()
Clears buffer. |
protected void |
ensureCapacity(int requiredCapacity)
Ensures the buffer can accommodate the required capacity. |
protected void |
expand()
Expands buffer's capacity. |
protected int |
getMode()
Returns the current mode: |
boolean |
hasData()
Determines if the buffer contains data. |
int |
length()
Returns the length of this buffer. |
protected void |
setInputMode()
Sets input mode. |
protected void |
setOutputMode()
Sets output mode. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int INPUT_MODE
public static final int OUTPUT_MODE
protected ByteBuffer buffer
| Constructor Detail |
|---|
public ExpandableBuffer(int buffersize,
ByteBufferAllocator allocator)
buffersize - the buffer size.allocator - allocator to be used to allocate ByteBuffers.| Method Detail |
|---|
protected int getMode()
INPUT_MODE: the buffer is in the input mode.
OUTPUT_MODE: the buffer is in the output mode.
protected void setOutputMode()
protected void setInputMode()
protected void expand()
protected void ensureCapacity(int requiredCapacity)
requiredCapacity - public int capacity()
capacity in interface BufferInfopublic boolean hasData()
true if there is data in the buffer,
false otherwise.public int length()
length in interface BufferInfopublic int available()
available in interface BufferInfoprotected void clear()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||