Package org.eclipse.mat.hprof
Class HprofHeapObjectReader
- java.lang.Object
-
- org.eclipse.mat.hprof.HprofHeapObjectReader
-
- All Implemented Interfaces:
IObjectReader
public class HprofHeapObjectReader extends java.lang.Object implements IObjectReader
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringHPROF_HEAP_STARTstatic java.lang.StringHPROF_LENGTH_PROPERTYstatic java.lang.StringVERSION_PROPERTY
-
Constructor Summary
Constructors Constructor Description HprofHeapObjectReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()tidy up when snapshot no longer required<A> AgetAddon(java.lang.Class<A> addon)Returns extra data to be provided byISnapshot.getSnapshotAddons(Class addon).voidopen(ISnapshot snapshot)Open the dump file associated with the snapshotIObjectread(int objectId, ISnapshot snapshot)Get detailed information about an objectlong[]readObjectArrayContent(ObjectArrayImpl array, int offset, int length)Get detailed information about a object arrayjava.lang.ObjectreadPrimitiveArrayContent(PrimitiveArrayImpl array, int offset, int length)Get detailed information about a primitive array
-
-
-
Field Detail
-
VERSION_PROPERTY
public static final java.lang.String VERSION_PROPERTY
- See Also:
- Constant Field Values
-
HPROF_LENGTH_PROPERTY
public static final java.lang.String HPROF_LENGTH_PROPERTY
- See Also:
- Constant Field Values
-
HPROF_HEAP_START
public static final java.lang.String HPROF_HEAP_START
- See Also:
- Constant Field Values
-
-
Method Detail
-
open
public void open(ISnapshot snapshot) throws java.io.IOException
Description copied from interface:IObjectReaderOpen the dump file associated with the snapshot- Specified by:
openin interfaceIObjectReader- Parameters:
snapshot- the snapshot- Throws:
java.io.IOException- an IO problem, or corrupt indexes or unexpected data in the dump
-
readObjectArrayContent
public long[] readObjectArrayContent(ObjectArrayImpl array, int offset, int length) throws java.io.IOException, SnapshotException
Description copied from interface:IObjectReaderGet detailed information about a object array- Specified by:
readObjectArrayContentin interfaceIObjectReader- Parameters:
array- the arrayoffset- where in the array to startlength- how much to read- Returns:
- an array of object addresses, with 0 for nulls
- Throws:
java.io.IOException- an IO problem or unexpected data in the dumpSnapshotException- some other problem such as where the object is incompatible with the snapshot
-
readPrimitiveArrayContent
public java.lang.Object readPrimitiveArrayContent(PrimitiveArrayImpl array, int offset, int length) throws java.io.IOException, SnapshotException
Description copied from interface:IObjectReaderGet detailed information about a primitive array- Specified by:
readPrimitiveArrayContentin interfaceIObjectReader- Parameters:
array- the arrayoffset- where in the array to startlength- how much to read- Returns:
- a byte[], short[], int[], long[], boolean[], char[], float[], double[]
- Throws:
java.io.IOException- an IO problem or unexpected data in the dumpSnapshotException- some other problem such as where the object is incompatible with the snapshot
-
read
public IObject read(int objectId, ISnapshot snapshot) throws SnapshotException, java.io.IOException
Description copied from interface:IObjectReaderGet detailed information about an object- Specified by:
readin interfaceIObjectReader- Parameters:
objectId- the object idsnapshot- the snapshot- Returns:
- an IObject such as
InstanceImpl,ObjectArrayImpl,PrimitiveArrayImpl,ClassLoaderImpl - Throws:
SnapshotException- some other problem such as where the object is incompatible with the snapshotjava.io.IOException- an IO problem or unexpected data in the dump
-
getAddon
public <A> A getAddon(java.lang.Class<A> addon) throws SnapshotExceptionReturns extra data to be provided byISnapshot.getSnapshotAddons(Class addon). Also can be returned viaArgument.- Specified by:
getAddonin interfaceIObjectReader- Type Parameters:
A- used to set the return type- Parameters:
addon- the type of the extra data required from the dump. HprofHeapObjectReader can be extended using anIRuntimeEnhancerextension to return extra data.- Returns:
- the extra data
- Throws:
SnapshotException- an IO problem or unexpected data in the dump- See Also:
IObjectReader.getAddon(Class)
-
close
public void close() throws java.io.IOExceptionDescription copied from interface:IObjectReadertidy up when snapshot no longer required- Specified by:
closein interfaceIObjectReader- Throws:
java.io.IOException- should not normally occur
-
-