public class Objects
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
ADDRESS_SIZE |
static long |
ARRAY_BASE_OFFSET |
static int |
ARRAY_HEADER_SIZE |
static int |
ARRAY_INDEX_SCALE |
static boolean |
COMPRESSED_OOPS |
static long |
KLASS_OFFSET |
static int |
OBJECT_HEADER_SIZE |
static int |
OOP_SIZE |
| Constructor and Description |
|---|
Objects() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
cast(java.lang.Object o,
java.lang.Class<T> target)
Cast the given object to the given class.
|
static <T> T |
cast(java.lang.Object o,
long klass)
Cast the given object to the given class pointer.
|
static <T> T |
cast(java.lang.Object o,
java.lang.Object target)
Cast the given object to the given object.
|
static void |
copyMemory(java.lang.Object from,
long fromOffset,
java.lang.Object to,
long toOffset,
long size)
Copy the memory from one object to another with the given offsets.
|
static void |
copyMemory(java.lang.Object from,
java.lang.Object to,
long size)
Copy the memory from one object to another.
|
static <T> T |
fromAddress(long address)
Get the object at the given memory address.
|
static long |
getKlass(java.lang.Class<?> clazz)
Get the class pointer of the given class.
|
static long |
getKlass(java.lang.Object o)
Get the class pointer of the given object.
|
static long |
toAddress(java.lang.Object o)
Get the memory address of an object.
|
public static final long ARRAY_BASE_OFFSET
public static final int ARRAY_INDEX_SCALE
public static final int ADDRESS_SIZE
public static final int OOP_SIZE
public static final int OBJECT_HEADER_SIZE
public static final int ARRAY_HEADER_SIZE
public static final boolean COMPRESSED_OOPS
public static final long KLASS_OFFSET
public static long toAddress(java.lang.Object o)
o - The objectpublic static <T> T fromAddress(long address)
T - The type of the objectaddress - The memory addresspublic static void copyMemory(java.lang.Object from,
java.lang.Object to,
long size)
from - The source objectto - The target objectsize - The size of the memory to copypublic static void copyMemory(java.lang.Object from,
long fromOffset,
java.lang.Object to,
long toOffset,
long size)
from - The source objectfromOffset - The offset in the source objectto - The target objecttoOffset - The offset in the target objectsize - The size of the memory to copypublic static long getKlass(java.lang.Class<?> clazz)
clazz - The classpublic static long getKlass(java.lang.Object o)
o - The objectpublic static <T> T cast(java.lang.Object o,
java.lang.Class<T> target)
T - The type of the objecto - The objecttarget - The target classpublic static <T> T cast(java.lang.Object o,
java.lang.Object target)
T - The type of the objecto - The objecttarget - The target objectpublic static <T> T cast(java.lang.Object o,
long klass)
T - The type of the objecto - The objectklass - The class pointer