public class HeapBytes extends ByteBufferBytes
ByteBuffer based heap bytes.| Modifier and Type | Field and Description |
|---|---|
static byte[] |
EMPTY |
| Modifier and Type | Method and Description |
|---|---|
static HeapBytes |
allocate(int size)
Allocates a new heap byte array.
|
boolean |
hasArray()
Returns whether the bytes has an array.
|
static HeapBytes |
wrap(byte[] bytes)
Wraps the given bytes in a
UnsafeHeapBytes object. |
array, byteBuffer, order, order, read, read, readByte, readChar, readDouble, readFloat, readInt, readLong, readShort, reset, resize, size, write, write, writeByte, writeChar, writeDouble, writeFloat, writeInt, writeLong, writeShort, zero, zero, zeroclose, flush, isDirect, isFile, readBoolean, readMedium, readString, readString, readUnsignedByte, readUnsignedInt, readUnsignedMedium, readUnsignedShort, readUTF8, writeBoolean, writeMedium, writeString, writeString, writeUnsignedByte, writeUnsignedInt, writeUnsignedMedium, writeUnsignedShort, writeUTF8public static HeapBytes allocate(int size)
size - The count of the buffer to allocate (in bytes).IllegalArgumentException - If count is greater than the maximum allowed count for
an array on the Java heap - Integer.MAX_VALUE - 5public static HeapBytes wrap(byte[] bytes)
UnsafeHeapBytes object.
The returned Bytes object will be backed by a HeapMemory instance that
wraps the given byte array. The Bytes.size() will be equivalent to the provided
by array length.
bytes - The bytes to wrap.public boolean hasArray()
BytesCopyright © 2013–2018. All rights reserved.