public class ByteArrayBuffer extends Buffer
Buffer
using a backing byte arrayModifier and Type | Field and Description |
---|---|
private byte[] |
data |
static int |
DEFAULT_SIZE |
static int |
MAX_LEN |
private int |
rpos |
private int |
wpos |
Constructor and Description |
---|
ByteArrayBuffer() |
ByteArrayBuffer(byte[] data) |
ByteArrayBuffer(byte[] data,
boolean read) |
ByteArrayBuffer(byte[] data,
int off,
int len) |
ByteArrayBuffer(byte[] data,
int off,
int len,
boolean read) |
ByteArrayBuffer(int size) |
ByteArrayBuffer(int size,
boolean roundOff) |
Modifier and Type | Method and Description |
---|---|
byte[] |
array() |
int |
available() |
int |
capacity() |
void |
clear(boolean wipeData) |
void |
compact() |
protected void |
copyRawBytes(int offset,
byte[] buf,
int pos,
int len) |
void |
ensureCapacity(int capacity,
java.util.function.IntUnaryOperator growthFactor) |
byte |
getByte() |
static ByteArrayBuffer |
getCompactClone(byte[] data)
Creates a compact buffer (i.e., one that starts at offset zero) containing a copy
of the original data
|
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
|
void |
getRawBytes(byte[] buf,
int off,
int len) |
java.lang.String |
getString(java.nio.charset.Charset charset) |
void |
putBuffer(java.nio.ByteBuffer buffer) |
int |
putBuffer(Readable buffer,
boolean expand) |
void |
putByte(byte b) |
void |
putRawBytes(byte[] d,
int off,
int len) |
int |
rpos() |
void |
rpos(int rpos) |
protected int |
size() |
int |
wpos() |
void |
wpos(int wpos) |
clear, dumpHex, dumpHex, ensureAvailable, ensureCapacity, extractEC, getAvailableStrings, getAvailableStrings, getBoolean, getBytes, getCompactData, getInt, getKeyPair, getLong, getMPInt, getMPIntAsBytes, getPublicKey, getPublicKey, getRawBytes, getRawPublicKey, getRawPublicKey, getShort, getString, getStringList, getStringList, getStringList, getStringList, getUByte, getUInt, isValidMessageStructure, isValidMessageStructure, putAndWipeBytes, putAndWipeBytes, putAndWipeChars, putAndWipeChars, putAndWipeChars, putAndWipeChars, putBoolean, putBuffer, putBytes, putBytes, putChars, putChars, putChars, putChars, putInt, putKeyPair, putLong, putMPInt, putMPInt, putPublicKey, putRawBytes, putRawPublicKey, putShort, putString, putString, putStringList, putStringList, toHex, toString
public static final int DEFAULT_SIZE
public static final int MAX_LEN
private byte[] data
private int rpos
private int wpos
public ByteArrayBuffer()
public ByteArrayBuffer(int size)
public ByteArrayBuffer(int size, boolean roundOff)
public ByteArrayBuffer(byte[] data)
public ByteArrayBuffer(byte[] data, boolean read)
public ByteArrayBuffer(byte[] data, int off, int len)
public ByteArrayBuffer(byte[] data, int off, int len, boolean read)
public int available()
public int putBuffer(Readable buffer, boolean expand)
public void putRawBytes(byte[] d, int off, int len)
putRawBytes
in class Buffer
public java.lang.String getString(java.nio.charset.Charset charset)
public void getRawBytes(byte[] buf, int off, int len)
protected void copyRawBytes(int offset, byte[] buf, int pos, int len)
copyRawBytes
in class Buffer
public void ensureCapacity(int capacity, java.util.function.IntUnaryOperator growthFactor)
ensureCapacity
in class Buffer
capacity
- The requires capacitygrowthFactor
- An 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 thrownpublic static ByteArrayBuffer getCompactClone(byte[] data)
data
- The original data bufferByteArrayBuffer
containing a copy of the original data
starting at zero read positiongetCompactClone(byte[], int, int)
public static ByteArrayBuffer getCompactClone(byte[] data, int offset, int len)
data
- The original data bufferoffset
- The offset of the valid data in the bufferlen
- The size (in bytes) of of the valid data in the bufferByteArrayBuffer
containing a copy of the original data
starting at zero read position