|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface JavaObject
Represents a Java object or array.
Array elements can be retrieved using the #arraycopy()
method. Object instance fields
can be retrieved using the get*()
methods in JavaField
such as
JavaField.get(JavaObject)
. The JavaField
objects can be retrieved from an
object's JavaClass
using JavaClass.getDeclaredFields()
.
Method Summary | |
---|---|
void |
arraycopy(int srcStart,
java.lang.Object dst,
int dstStart,
int length)
Copies data from the array this JavaObject represents into an array. |
boolean |
equals(java.lang.Object obj)
|
int |
getArraySize()
Get the number of elements in this array. |
long |
getHashcode()
Fetch the basic hash code for the object. |
JavaHeap |
getHeap()
Gets the heap where this object is located. |
ImagePointer |
getID()
The ID of an object is a unique address is memory which identifies the object. |
JavaClass |
getJavaClass()
Get the JavaClass instance which represents the class of this object. |
long |
getPersistentHashcode()
Fetch the basic hash code of the object in the image. |
java.util.List<JavaReference> |
getReferences()
Get the set of references from this object. |
java.util.List<ImageSection> |
getSections()
Returns the sections that this object occupies in memory. |
long |
getSize()
Get the number of bytes of memory occupied by this object. |
int |
hashCode()
|
boolean |
isArray()
Returns true if this JavaObject represents an array. |
Method Detail |
---|
JavaClass getJavaClass() throws CorruptDataException
Get the JavaClass instance which represents the class of this object.
This method never returns null, all objects have a class. The JavaClass returned might be synthetic for array types.
CorruptDataException
boolean isArray() throws CorruptDataException
Returns true if this JavaObject represents an array.
CorruptDataException
int getArraySize() throws CorruptDataException
Get the number of elements in this array.
This is equivalent to calling array.length
in Java, where array
is an
array reference.
CorruptDataException
java.lang.IllegalArgumentException
- if the object is not an array.void arraycopy(int srcStart, java.lang.Object dst, int dstStart, int length) throws CorruptDataException, MemoryAccessException
Copies data from the array this JavaObject represents into an array.
The dst object must be an array of the appropriate type -- a primitive type array for base types, or a JavaObject array for reference arrays.
srcStart
- index in the receiver to start copying from.dst
- the destination array.dstStart
- index in the destination array to start copying into.length
- the number of elements to be copied.
CorruptDataException
MemoryAccessException
java.lang.NullPointerException
- if dst is null.
java.lang.IllegalArgumentException
- if the object is not an array,
or if dst is not an array of the appropriate type.
java.lang.IndexOutOfBoundsException
- if srcStart, dstStart, or length
are out of bounds in either the JavaObject or the destination array.long getSize() throws CorruptDataException
Get the number of bytes of memory occupied by this object.
CorruptDataException
long getHashcode() throws DataUnavailable, CorruptDataException
Fetch the basic hash code for the object.
This is the hash code which would be returned if a Java thread had requested it. Typically the hash code is based on the address of an object, and may change if the object is moved by a garbage collect cycle.
DataUnavailable
- if the hash code cannot be determined.
CorruptDataException
getPersistentHashcode()
long getPersistentHashcode() throws DataUnavailable, CorruptDataException
If the VM uses a 'hasBeenHashed' bit, the value of this bit can be inferred by calling getPersistentHashcode(). If the persistent hash code is not available, then the 'hasBeenHashed' bit has not been set, and the hash of the object could change if the object moves between snapshots
DataUnavailable
- if a hash code cannot be determined, or if the
hash code could change between successive snapshots
CorruptDataException
getHashcode()
ImagePointer getID()
The ID of an object is a unique address is memory which identifies the object.
It is probable that an object's address will change during the lifetime of a Java Virtual Machine because of the operations of the garbage collector. Other mechanisms for uniquely identifying objects should be used when comparing dumps.
The data at this memory is implementation defined. The object may be non-contiguous. Portions of the object may appear below or above this address.
java.util.List<ImageSection> getSections()
Returns the sections that this object occupies in memory.
These sections include the object's header and the data in the object.
In certain allocation strategies, an object's header and data may be allocated contiguously. In this case, this method may return an iterator for a single section.
In other schemes, the header may be separate from the data or the data may be broken up into multiple regions. Additionally, this function does not guarantee that the memory used by this object is not also shared by one or more other objects.
The contents of the image sections are implementation specific, as so are undefined here.
ImageSection
java.util.List<JavaReference> getReferences()
Get the set of references from this object.
These references will include at least the object's references to its class, and any references from instance fields to other objects and classes, or array elements references to other objects.
JavaReference
JavaHeap getHeap() throws CorruptDataException, DataUnavailable
Gets the heap where this object is located.
A JavaHeap will always be returned if this object could be retrieved by
JavaHeap#getObject()
, otherwise DataUnavailable
is thrown.
JavaHeap
instance representing the heap where this object is stored in memory.
CorruptDataException
- if the heap information for this object is corrupt.
DataUnavailable
- if the heap information for this object is not available.JavaHeap
boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
-
int hashCode()
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |