public final class UnsafeUtil extends Object
NOTE: Native/Direct memory acquired using Unsafe may have garbage in it. It is the responsibility of the using class to clear this memory, if required, and to call freeMemory() when done.
| Modifier and Type | Method and Description |
|---|---|
static void |
assertBounds(long reqOff,
long reqLen,
long allocSize)
Perform bounds checking using java assert (if enabled) checking the requested offset and length
against the allocated size.
|
static void |
checkBounds(long reqOff,
long reqLen,
long allocSize)
Check the requested offset and length against the allocated size.
|
static boolean |
checkOverlap(long srcOff,
long dstOff,
long length)
Return true if the given offsets and length do not overlap.
|
public static final sun.misc.Unsafe unsafe
public static final int ADDRESS_SIZE
public static final int ARRAY_BOOLEAN_BASE_OFFSET
public static final int ARRAY_BYTE_BASE_OFFSET
public static final int ARRAY_SHORT_BASE_OFFSET
public static final int ARRAY_CHAR_BASE_OFFSET
public static final int ARRAY_INT_BASE_OFFSET
public static final int ARRAY_LONG_BASE_OFFSET
public static final int ARRAY_FLOAT_BASE_OFFSET
public static final int ARRAY_DOUBLE_BASE_OFFSET
public static final int ARRAY_OBJECT_BASE_OFFSET
public static final int ARRAY_BOOLEAN_INDEX_SCALE
public static final int ARRAY_BYTE_INDEX_SCALE
public static final int ARRAY_SHORT_INDEX_SCALE
public static final int ARRAY_CHAR_INDEX_SCALE
public static final int ARRAY_INT_INDEX_SCALE
public static final int ARRAY_LONG_INDEX_SCALE
public static final int ARRAY_FLOAT_INDEX_SCALE
public static final int ARRAY_DOUBLE_INDEX_SCALE
public static final int ARRAY_OBJECT_INDEX_SCALE
public static final int BOOLEAN_SHIFT
public static final int BYTE_SHIFT
public static final int SHORT_SHIFT
public static final int CHAR_SHIFT
public static final int INT_SHIFT
public static final int LONG_SHIFT
public static final int FLOAT_SHIFT
public static final int DOUBLE_SHIFT
public static final String LS
public static final long UNSAFE_COPY_THRESHOLD
public static void assertBounds(long reqOff,
long reqLen,
long allocSize)
reqOff - the requested offsetreqLen - the requested lengthallocSize - the allocated size.public static void checkBounds(long reqOff,
long reqLen,
long allocSize)
reqOff - the requested offsetreqLen - the requested lengthallocSize - the allocated size.public static boolean checkOverlap(long srcOff,
long dstOff,
long length)
srcOff - the start of the source regiondstOff - the start of the destination regionlength - the length of both regionsCopyright © 2015–2017 Yahoo! Inc.. All rights reserved.