@NotThreadSafe public class ExpandableBuffer extends java.lang.Object implements BufferInfo, BufferInfo
ByteBufferAllocator
interface. Internally, this class is backed by an instance of
ByteBuffer.
This class is not thread safe.
| 限定符和类型 | 字段和说明 |
|---|---|
protected java.nio.ByteBuffer |
buffer |
static int |
INPUT_MODE |
static int |
OUTPUT_MODE |
| 构造器和说明 |
|---|
ExpandableBuffer(int buffersize,
ByteBufferAllocator allocator)
Allocates buffer of the given size using the given allocator.
|
| 限定符和类型 | 方法和说明 |
|---|---|
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:
INPUT_MODE: the buffer is in the input 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.
|
java.lang.String |
toString() |
public static final int INPUT_MODE
public static final int OUTPUT_MODE
protected java.nio.ByteBuffer buffer
public ExpandableBuffer(int buffersize,
ByteBufferAllocator allocator)
buffersize - the buffer size.allocator - allocator to be used to allocate ByteBuffers.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)
public int capacity()
capacity 在接口中 BufferInfopublic boolean hasData()
true if there is data in the buffer,
false otherwise.public int length()
length 在接口中 BufferInfopublic int available()
available 在接口中 BufferInfoprotected void clear()
public java.lang.String toString()
toString 在类中 java.lang.Object