com.alexkasko.unsafe.offheapstruct
private static class OffHeapStructComparator.OffHeapStructIndexAccessor extends Object implements OffHeapStructAccessor
| Modifier and Type | Field and Description |
|---|---|
private OffHeapStructCollection |
col |
private long |
index |
| Modifier | Constructor and Description |
|---|---|
private |
OffHeapStructComparator.OffHeapStructIndexAccessor(OffHeapStructCollection col)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
get(byte[] buffer)
Copies struct into specified buffer
|
void |
get(int srcPos,
byte[] dest,
int destPos,
int length)
Copies part of struct into specified buffer
|
byte |
getByte(int offset)
Gets byte from struct with specified offset
|
int |
getInt(int offset)
Gets four bytes as int from struct with specified offset
|
long |
getLong(int offset)
Gets long from struct with specified offset
|
short |
getShort(int offset)
Gets two bytes as short from struct with specified offset
|
short |
getUnsignedByte(int offset)
Gets one byte (stored as one signed byte) from struct on specified index
with specified offset, converts it to unsigned and returns it as short
|
long |
getUnsignedInt(int offset)
Gets unsigned int (stored as 4 bytes) and returns it as long
from struct with specified offset
|
int |
getUnsignedShort(int offset)
Gets unsigned short (stored as two bytes) from struct on specified index
with specified offset and returns it as int
|
private void |
setIndex(long index)
Sets index value
|
int |
structLength()
Returns length of the single struct in bytes
|
String |
toString() |
private final OffHeapStructCollection col
private long index
private OffHeapStructComparator.OffHeapStructIndexAccessor(OffHeapStructCollection col)
col - collection to access structs frompublic int structLength()
structLength in interface OffHeapStructAccessorpublic void get(byte[] buffer)
get in interface OffHeapStructAccessorbuffer - buffer to copy struct intopublic void get(int srcPos, byte[] dest, int destPos, int length)
get in interface OffHeapStructAccessorpublic byte getByte(int offset)
getByte in interface OffHeapStructAccessoroffset - byte array indexpublic short getUnsignedByte(int offset)
getUnsignedByte in interface OffHeapStructAccessoroffset - byte array indexpublic short getShort(int offset)
getShort in interface OffHeapStructAccessoroffset - byte array offsetpublic int getUnsignedShort(int offset)
getUnsignedShort in interface OffHeapStructAccessoroffset - byte array offsetpublic int getInt(int offset)
getInt in interface OffHeapStructAccessoroffset - byte array offsetpublic long getUnsignedInt(int offset)
getUnsignedInt in interface OffHeapStructAccessoroffset - byte array offsetpublic long getLong(int offset)
getLong in interface OffHeapStructAccessoroffset - byte array offsetprivate void setIndex(long index)
index - index valueCopyright © 2014. All Rights Reserved.