|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DirectBuffer
Abstraction over a range of buffer types that allows fields to be read in native typed fashion.
Method Summary | |
---|---|
long |
addressOffset()
Reads the underlying offset to to the memory address. |
void |
boundsCheck(int index,
int length)
Check that a given length of bytes is within the bounds from a given index. |
byte[] |
byteArray()
Get the underlying byte[] if one exists. |
ByteBuffer |
byteBuffer()
Get the underlying ByteBuffer if one exists. |
int |
capacity()
Get the capacity of the underlying buffer. |
void |
checkLimit(int limit)
Check that a given limit is not greater than the capacity of a buffer from a given offset. |
byte |
getByte(int index)
Get the value at a given index. |
void |
getBytes(int index,
byte[] dst)
Get from the underlying buffer into a supplied byte array. |
void |
getBytes(int index,
byte[] dst,
int offset,
int length)
Get bytes from the underlying buffer into a supplied byte array. |
void |
getBytes(int index,
ByteBuffer dstBuffer,
int length)
Get from the underlying buffer into a supplied ByteBuffer . |
void |
getBytes(int index,
MutableDirectBuffer dstBuffer,
int dstIndex,
int length)
Get bytes from this DirectBuffer into the provided MutableDirectBuffer at given indices. |
double |
getDouble(int index)
Get the value at a given index. |
double |
getDouble(int index,
ByteOrder byteOrder)
Get the value at a given index. |
float |
getFloat(int index)
Get the value at a given index. |
float |
getFloat(int index,
ByteOrder byteOrder)
Get the value at a given index. |
int |
getInt(int index)
Get the value at a given index. |
int |
getInt(int index,
ByteOrder byteOrder)
Get the value at a given index. |
long |
getLong(int index)
Get the value at a given index. |
long |
getLong(int index,
ByteOrder byteOrder)
Get the value at a given index. |
short |
getShort(int index)
Get the value at a given index. |
short |
getShort(int index,
ByteOrder byteOrder)
Get the value at a given index. |
String |
getStringUtf8(int offset,
ByteOrder byteOrder)
Get a String from bytes encoded in UTF-8 format that is length prefixed. |
String |
getStringUtf8(int offset,
int length)
Get part of String from bytes encoded in UTF-8 format that is length prefixed. |
String |
getStringWithoutLengthUtf8(int offset,
int length)
Get an encoded UTF-8 String from the buffer that does not have a length prefix. |
void |
wrap(byte[] buffer)
Attach a view to a byte[] for providing direct access. |
void |
wrap(byte[] buffer,
int offset,
int length)
Attach a view to a byte[] for providing direct access. |
void |
wrap(ByteBuffer buffer)
Attach a view to a ByteBuffer for providing direct access, the ByteBuffer can be
heap based or direct. |
void |
wrap(ByteBuffer buffer,
int offset,
int length)
Attach a view to a ByteBuffer for providing direct access. |
void |
wrap(DirectBuffer buffer)
Attach a view to an existing DirectBuffer |
void |
wrap(DirectBuffer buffer,
int offset,
int length)
Attach a view to a DirectBuffer for providing direct access. |
void |
wrap(long address,
int length)
Attach a view to an off-heap memory region by address. |
Method Detail |
---|
void wrap(byte[] buffer)
buffer
- to which the view is attached.void wrap(byte[] buffer, int offset, int length)
buffer
- to which the view is attached.offset
- at which the view begins.length
- of the buffer included in the viewvoid wrap(ByteBuffer buffer)
ByteBuffer
for providing direct access, the ByteBuffer
can be
heap based or direct.
buffer
- to which the view is attached.void wrap(ByteBuffer buffer, int offset, int length)
ByteBuffer
for providing direct access.
buffer
- to which the view is attached.offset
- at which the view begins.length
- of the buffer included in the viewvoid wrap(DirectBuffer buffer)
DirectBuffer
buffer
- to which the view is attached.void wrap(DirectBuffer buffer, int offset, int length)
DirectBuffer
for providing direct access.
buffer
- to which the view is attached.offset
- at which the view begins.length
- of the buffer included in the viewvoid wrap(long address, int length)
address
- where the memory begins off-heaplength
- of the buffer from the given addresslong addressOffset()
byte[] byteArray()
ByteBuffer byteBuffer()
ByteBuffer
if one exists.
ByteBuffer
if one exists.int capacity()
void checkLimit(int limit)
limit
- up to which access is required.
IndexOutOfBoundsException
- if limit is beyond buffer capacity.long getLong(int index, ByteOrder byteOrder)
index
- in bytes from which to get.byteOrder
- of the value to be read.
long getLong(int index)
index
- in bytes from which to get.
int getInt(int index, ByteOrder byteOrder)
index
- in bytes from which to get.byteOrder
- of the value to be read.
int getInt(int index)
index
- in bytes from which to get.
double getDouble(int index, ByteOrder byteOrder)
index
- in bytes from which to get.byteOrder
- of the value to be read.
double getDouble(int index)
index
- in bytes from which to get.
float getFloat(int index, ByteOrder byteOrder)
index
- in bytes from which to get.byteOrder
- of the value to be read.
float getFloat(int index)
index
- in bytes from which to get.
short getShort(int index, ByteOrder byteOrder)
index
- in bytes from which to get.byteOrder
- of the value to be read.
short getShort(int index)
index
- in bytes from which to get.
byte getByte(int index)
index
- in bytes from which to get.
void getBytes(int index, byte[] dst)
index
- in the underlying buffer to start from.dst
- into which the dst will be copied.void getBytes(int index, byte[] dst, int offset, int length)
index
- in the underlying buffer to start from.dst
- into which the bytes will be copied.offset
- in the supplied buffer to start the copylength
- of the supplied buffer to use.void getBytes(int index, MutableDirectBuffer dstBuffer, int dstIndex, int length)
DirectBuffer
into the provided MutableDirectBuffer
at given indices.
index
- in this buffer to begin getting the bytes.dstBuffer
- to which the bytes will be copied.dstIndex
- in the channel buffer to which the byte copy will begin.length
- of the bytes to be copied.void getBytes(int index, ByteBuffer dstBuffer, int length)
ByteBuffer
.
index
- in the underlying buffer to start from.dstBuffer
- into which the bytes will be copied.length
- of the supplied buffer to use.String getStringUtf8(int offset, ByteOrder byteOrder)
offset
- at which the String begins.byteOrder
- for the length at the beginning of the String.
String getStringUtf8(int offset, int length)
offset
- at which the String begins.length
- of the String in bytes to decode.
String getStringWithoutLengthUtf8(int offset, int length)
offset
- at which the String begins.length
- of the String in bytes to decode.
void boundsCheck(int index, int length)
index
- from which to check.length
- in bytes of the range to check.
IndexOutOfBoundsException
- if the length goes outside of the capacity range.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |