public class UnsafeUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static sun.misc.Unsafe |
_unsafe |
static long |
byteArrayBaseOffset |
static long |
charArrayBaseOffset |
(package private) static java.lang.reflect.Constructor<? extends java.nio.ByteBuffer> |
directByteBufferConstr |
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 java.nio.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(java.nio.ByteBuffer niobuffer)
Release a direct buffer.
|
static java.lang.reflect.Field[] |
sortFieldsByOffset(java.util.List<java.lang.reflect.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.
|
private static final sun.misc.Unsafe _unsafe
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
static java.lang.reflect.Constructor<? extends java.nio.ByteBuffer> directByteBufferConstr
public static final sun.misc.Unsafe unsafe()
public static java.lang.reflect.Field[] sortFieldsByOffset(java.util.List<java.lang.reflect.Field> allFields)
allFields - set of fields to be sorted by their offsetspublic static final java.nio.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(java.nio.ByteBuffer niobuffer)