Buffer using a backing byte array
| Modifier and Type | Field and Description |
|---|---|
| private byte[] | |
| public static final int | DEFAULT_SIZE
Initial default allocated buffer size if none specified |
| private int | |
| private int |
| Access | Constructor and Description |
|---|---|
| public | |
| public | ByteArrayBuffer(int
Initial buffer size - Note: it is rounded to the closest power of 2 that is greater or
equal to it. size)Allocates a buffer for writing purposes |
| public | ByteArrayBuffer(int
Initial buffer size size, boolean Whether to round it to closest power of 2 that is greater or equal to the specified size roundOff)Allocates a buffer for writing purposes |
| public | |
| public | ByteArrayBuffer(byte[]
Data bytes to use data, boolean Whether the data bytes are for reading or writing read)
|
| public | ByteArrayBuffer(byte[]
Data bytes to read from data, int Offset to read from off, int Available bytes from given offset len)Wraps data bytes for reading |
| public | ByteArrayBuffer(byte[]
Data bytes to use data, int Offset to read/write (according to read parameter) off, int Available bytes from given offset len, boolean Whether the data bytes are for reading or writing read)
|
| Modifier and Type | Method and Description |
|---|---|
| public byte[] | |
| public int | |
| public int | |
| public Buffer | clear(boolean
Whether to zero any previously existing data wipeData)Implements abstract org. Reset read/write positions to zero |
| public void | compact()
Implements abstract org. "Shift" the internal data so that reading starts from position zero. |
| protected void | copyRawBytes(int offset, byte[] buf, int pos, int len)
Implements abstract org.
|
| public Buffer | ensureCapacity(int
The required capacity capacity, IntUnaryOperator An growthFactor)IntUnaryOperator that is invoked if the current capacity is insufficient. The
argument is the minimum required new data length, the function result should be the
effective new data length to be allocated - if less than minimum then an exception is thrownImplements abstract org.
|
| public byte | |
| public byte[] | |
| public byte[] | getBytesConsumed(int from)
Implements abstract org.
|
| public static ByteArrayBuffer | Returns: AByteArrayBuffer containing a copy of the original data starting at zero read
positionThe original data buffer data)Creates a compact buffer (i.e., one that starts at offset zero) containing a copy of the original data |
| public static ByteArrayBuffer | Returns: AByteArrayBuffer containing a copy of the original data starting at zero read
positionThe original data buffer data, int The offset of the valid data in the buffer offset, int The size (in bytes) of of the valid data in the buffer len)Creates a compact buffer (i.e., one that starts at offset zero) containing a copy of the original data |
| public int | |
| public void | getRawBytes(byte[] buf, int off, int len)
Implements org.
|
| public String | getString(Charset
The charset)Charset to use for the string bytesImplements abstract org. Reads a string using a given charset. |
| public long | |
| public int | putBuffer(Readable buffer, boolean expand)
Implements abstract org.
|
| public void | putBuffer(ByteBuffer buffer)
Implements abstract org.
|
| public void | |
| public void | |
| public void | |
| public void | putRawBytes(byte[] d, int off, int len)
Implements abstract org.
|
| public void | putUInt(long
The 32-bit value i)Overrides org. Writes 32 bits |
| public byte | rawByte(int
A position in the raw underlying data bytes pos)Overrides org.
|
| public long | rawUInt(int
A position in the raw underlying data bytes pos)Overrides org.
|
| public int | |
| public void | rpos(int
Set current reading position rpos)Implements abstract org.
|
| protected int | |
| public int | |
| public void | wpos(int
Set current writing position - Note: if necessary, the underlying data buffer will be
increased so as to allow writing from the new position wpos)Implements abstract org.
|
| data | back to summary |
|---|---|
| private byte[] data | |
| DEFAULT_SIZE | back to summary |
|---|---|
| public static final int DEFAULT_SIZE Initial default allocated buffer size if none specified | |
| rpos | back to summary |
|---|---|
| private int rpos | |
| wpos | back to summary |
|---|---|
| private int wpos | |
| ByteArrayBuffer | back to summary |
|---|---|
| public ByteArrayBuffer() Allocates a buffer for writing purposes with 256 bytes | |
| ByteArrayBuffer | back to summary |
|---|---|
| public ByteArrayBuffer(int size) Allocates a buffer for writing purposes
| |
| ByteArrayBuffer | back to summary |
|---|---|
| public ByteArrayBuffer(int size, boolean roundOff) Allocates a buffer for writing purposes
| |
| ByteArrayBuffer | back to summary |
|---|---|
| public ByteArrayBuffer(byte[] data) Wraps data bytes for reading
| |
| ByteArrayBuffer | back to summary |
|---|---|
public ByteArrayBuffer(byte[] data, boolean read)
| |
| ByteArrayBuffer | back to summary |
|---|---|
| public ByteArrayBuffer(byte[] data, int off, int len) Wraps data bytes for reading
| |
| ByteArrayBuffer | back to summary |
|---|---|
public ByteArrayBuffer(byte[] data, int off, int len, boolean read)
| |
| array | back to summary |
|---|---|
| public byte[] array() Implements abstract org.
| |
| available | back to summary |
|---|---|
| public int available() Implements org.
| |
| capacity | back to summary |
|---|---|
| public int capacity() Implements abstract org.
| |
| clear | back to summary |
|---|---|
| public Buffer clear(boolean wipeData) Implements abstract org. Doc from org. Reset read/write positions to zero | |
| compact | back to summary |
|---|---|
| public void compact() Implements abstract org. Doc from org. "Shift" the internal data so that reading starts from position zero.
| |
| copyRawBytes | back to summary |
|---|---|
| protected void copyRawBytes(int offset, byte[] buf, int pos, int len) Implements abstract org.
| |
| ensureCapacity | back to summary |
|---|---|
| public Buffer ensureCapacity(int capacity, IntUnaryOperator growthFactor) Implements abstract org.
| |
| getByte | back to summary |
|---|---|
| public byte getByte() Overrides org.
| |
| getBytesConsumed | back to summary |
|---|---|
| public byte[] getBytesConsumed() Implements abstract org.
| |
| getBytesConsumed | back to summary |
|---|---|
| public byte[] getBytesConsumed(int from) Implements abstract org.
| |
| getCompactClone | back to summary |
|---|---|
| public static ByteArrayBuffer getCompactClone(byte[] data) Creates a compact buffer (i.e., one that starts at offset zero) containing a copy of the original data
| |
| getCompactClone | back to summary |
|---|---|
| public static ByteArrayBuffer getCompactClone(byte[] data, int offset, int len) Creates a compact buffer (i.e., one that starts at offset zero) containing a copy of the original data
| |
| getInt | back to summary |
|---|---|
| public int getInt() Overrides org.
| |
| getRawBytes | back to summary |
|---|---|
| public void getRawBytes(byte[] buf, int off, int len) Implements org.
| |
| getString | back to summary |
|---|---|
| public String getString(Charset charset) Implements abstract org. Doc from org. Reads a string using a given charset. | |
| getUInt | back to summary |
|---|---|
| public long getUInt() Overrides org.
| |
| putBuffer | back to summary |
|---|---|
| public int putBuffer(Readable buffer, boolean expand) Implements abstract org.
| |
| putBuffer | back to summary |
|---|---|
| public void putBuffer(ByteBuffer buffer) Implements abstract org.
| |
| putByte | back to summary |
|---|---|
| public void putByte(byte b) Overrides org.
| |
| putBytes | back to summary |
|---|---|
| public void putBytes(byte[] b, int off, int len) Overrides org.
| |
| putInt | back to summary |
|---|---|
| public void putInt(long i) Overrides org.
| |
| putRawBytes | back to summary |
|---|---|
| public void putRawBytes(byte[] d, int off, int len) Implements abstract org.
| |
| putUInt | back to summary |
|---|---|
| public void putUInt(long i) Overrides org. Doc from org. Writes 32 bits
| |
| rawByte | back to summary |
|---|---|
| public byte rawByte(int pos) Overrides org.
| |
| rawUInt | back to summary |
|---|---|
| public long rawUInt(int pos) Overrides org.
| |
| rpos | back to summary |
|---|---|
| public int rpos() Implements abstract org.
| |
| rpos | back to summary |
|---|---|
| public void rpos(int rpos) Implements abstract org.
| |
| size | back to summary |
|---|---|
| protected int size() Implements abstract org.
| |
| wpos | back to summary |
|---|---|
| public int wpos() Implements abstract org.
| |
| wpos | back to summary |
|---|---|
| public void wpos(int wpos) Implements abstract org.
| |