public class UnsafeUtil extends Object
Modifier and Type | Field and Description |
---|---|
static long |
byteArrayBaseOffset |
static long |
charArrayBaseOffset |
static long |
doubleArrayBaseOffset |
static long |
floatArrayBaseOffset |
static long |
intArrayBaseOffset |
static long |
longArrayBaseOffset |
static long |
shortArrayBaseOffset |
Constructor and Description |
---|
UnsafeUtil() |
Modifier and Type | Method and Description |
---|---|
static ByteBuffer |
getDirectBufferAt(long address,
int size)
Create a ByteBuffer that uses a provided (off-heap) memory region instead of allocating a new one.
|
static void |
releaseBuffer(ByteBuffer niobuffer)
Release a direct buffer.
|
static Field[] |
sortFieldsByOffset(List<Field> allFields)
Sort the set of lists by their offsets from the object start address.
|
static sun.misc.Unsafe |
unsafe()
Return the sun.misc.Unsafe object.
|
public static final long byteArrayBaseOffset
public static final long floatArrayBaseOffset
public static final long doubleArrayBaseOffset
public static final long intArrayBaseOffset
public static final long longArrayBaseOffset
public static final long shortArrayBaseOffset
public static final long charArrayBaseOffset
public static final sun.misc.Unsafe unsafe()
public static Field[] sortFieldsByOffset(List<Field> allFields)
allFields
- set of fields to be sorted by their offsetspublic static final ByteBuffer getDirectBufferAt(long address, int size)
address
- address of the memory region to be used for a ByteBuffersize
- size of the memory regionpublic static void releaseBuffer(ByteBuffer niobuffer)
Copyright © 2018. All rights reserved.