public class UnsafeUtil
extends java.lang.Object
Unsafe
.
Not available on all JVMs. Util.unsafe
can be checked before using this class.
Modifier and Type | Field and Description |
---|---|
static long |
booleanArrayBaseOffset |
static long |
byteArrayBaseOffset |
static long |
charArrayBaseOffset |
static long |
doubleArrayBaseOffset |
static long |
floatArrayBaseOffset |
static long |
intArrayBaseOffset |
static long |
longArrayBaseOffset |
static long |
shortArrayBaseOffset |
static sun.misc.Unsafe |
unsafe
The sun.misc.Unsafe instance, or null if Unsafe is unavailable.
|
Constructor and Description |
---|
UnsafeUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
dispose(java.nio.ByteBuffer buffer)
Release a direct buffer immediately rather than waiting for GC.
|
static boolean |
isNewDirectBufferAvailable()
Returns true if
newDirectBuffer(long, int) can be called. |
static java.nio.ByteBuffer |
newDirectBuffer(long address,
int size)
Create a ByteBuffer that uses the specified off-heap memory address instead of allocating a new one.
|
public 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
public static final long booleanArrayBaseOffset
public static java.nio.ByteBuffer newDirectBuffer(long address, int size)
address
- Address of the memory region to be used for a ByteBuffer.size
- Size in bytes of the memory region.java.lang.UnsupportedOperationException
- if creating a ByteBuffer this way is not available.public static boolean isNewDirectBufferAvailable()
newDirectBuffer(long, int)
can be called.public static void dispose(java.nio.ByteBuffer buffer)
Copyright © 2019. All Rights Reserved.