@Internal public class ExpandableBuffer extends Object
ByteBuffer.
This class is not thread safe.
| 限定符和类型 | 类和说明 |
|---|---|
static class |
ExpandableBuffer.Mode |
| 限定符 | 构造器和说明 |
|---|---|
protected |
ExpandableBuffer(int bufferSize)
Allocates buffer of the given size using the given allocator.
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected ByteBuffer |
buffer() |
protected int |
capacity()
Returns available capacity of this buffer.
|
protected void |
clear()
Clears buffer.
|
protected void |
ensureAdjustedCapacity(int requiredCapacity)
Ensures the buffer can accommodate at least the required capacity adjusted to multiples of 1024.
|
protected void |
ensureCapacity(int requiredCapacity)
Ensures the buffer can accommodate the exact required capacity.
|
protected void |
expand()
Expands buffer's capacity.
|
protected boolean |
hasData()
Determines if the buffer contains data.
|
protected int |
length()
Returns the length of this buffer.
|
protected ExpandableBuffer.Mode |
mode()
Returns the current mode:
ExpandableBuffer.Mode.INPUT: the buffer is in the input mode. |
protected void |
setInputMode()
Sets the mode to input.
|
protected void |
setOutputMode()
Sets the mode to output.
|
String |
toString() |
protected ExpandableBuffer(int bufferSize)
Sets the mode to input.
bufferSize - the buffer size.protected ExpandableBuffer.Mode mode()
ExpandableBuffer.Mode.INPUT: the buffer is in the input mode.
ExpandableBuffer.Mode.OUTPUT: the buffer is in the output mode.
protected ByteBuffer buffer()
protected void setOutputMode()
protected void setInputMode()
protected void expand()
throws BufferOverflowException
BufferOverflowException - in case we get over the maximum allowed valueprotected void ensureCapacity(int requiredCapacity)
requiredCapacity - the required capacity.protected void ensureAdjustedCapacity(int requiredCapacity)
requiredCapacity - the required capacity.protected boolean hasData()
Sets the mode to output.
true if there is data in the buffer,
false otherwise.protected int length()
Sets the mode to output.
protected int capacity()
protected void clear()
Sets the mode to input.
Copyright © 2023. All rights reserved.