Package org.eclipse.mat.parser.model
Class PrimitiveArrayImpl
java.lang.Object
org.eclipse.mat.parser.model.AbstractObjectImpl
org.eclipse.mat.parser.model.AbstractArrayImpl
org.eclipse.mat.parser.model.PrimitiveArrayImpl
- All Implemented Interfaces:
Serializable,IArray,IObject,IPrimitiveArray
Implementation of a primitive array of type
byte[], short[], int[], long[],
boolean, char[], float[], double[].
- See Also:
- No Extend:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.mat.snapshot.model.IObject
IObject.Type -
Field Summary
Fields inherited from interface org.eclipse.mat.snapshot.model.IPrimitiveArray
COMPONENT_TYPE, ELEMENT_SIZE, SIGNATURES, TYPE -
Constructor Summary
ConstructorsConstructorDescriptionPrimitiveArrayImpl(int objectId, long address, ClassImpl classInstance, int length, int type) Constructs a primitive array -
Method Summary
Modifier and TypeMethodDescriptionstatic longdoGetUsedHeapSize(ClassImpl clazz, int length, int type) Calculates the size of a primitive arrayClass<?>Returns the component type of the array.Get list of snapshot objects referenced from this snapshot object with the name of the field over which it was referenced.Gets the outbound references from this object, as addresses.intgetType()Returns theIObject.Typeof the primitive array.longGet used heap size of just this object.Get the primitive Java array.getValueArray(int offset, int length) Get the primitive Java array, beginning atoffsetandlengthnumber of elements.getValueAt(int index) Returns the value of the array at the specified indexMethods inherited from class org.eclipse.mat.parser.model.AbstractArrayImpl
getInfo, getLength, getObjectAddress, getObjectId, getTechnicalName, setInfo, setLengthMethods inherited from class org.eclipse.mat.parser.model.AbstractObjectImpl
equals, getClassAddress, getClassId, getClassSpecificName, getClazz, getComparatorForClassSpecificName, getComparatorForTechnicalName, getComparatorForUsedHeapSize, getDisplayName, getGCRootInfo, getRetainedHeapSize, getSnapshot, hashCode, resolveValue, setClassInstance, setObjectAddress, setObjectId, setSnapshot, toStringMethods inherited from interface org.eclipse.mat.snapshot.model.IObject
getClassSpecificName, getClazz, getDisplayName, getGCRootInfo, getObjectAddress, getObjectId, getRetainedHeapSize, getSnapshot, getTechnicalName, resolveValue
-
Constructor Details
-
PrimitiveArrayImpl
public PrimitiveArrayImpl(int objectId, long address, ClassImpl classInstance, int length, int type) Constructs a primitive array- Parameters:
objectId- the id of the arrayaddress- the address of the arrayclassInstance- the type (class) of the arraylength- the length in elementstype- the actual typeIObject.Type
-
-
Method Details
-
getType
public int getType()Description copied from interface:IPrimitiveArrayReturns theIObject.Typeof the primitive array.- Specified by:
getTypein interfaceIPrimitiveArray- Returns:
- the type
-
getComponentType
Description copied from interface:IPrimitiveArrayReturns the component type of the array.- Specified by:
getComponentTypein interfaceIPrimitiveArray- Returns:
- the Java class of the component type
-
getValueAt
Description copied from interface:IPrimitiveArrayReturns the value of the array at the specified index- Specified by:
getValueAtin interfaceIPrimitiveArray- Parameters:
index- from 0 to length-1- Returns:
- Byte - for a byte array Short - for a short array Integer - for an int array Long - for a long array Boolean - for a boolean array Char - for a char array Float - for a float array Double - for a double array
-
getValueArray
Description copied from interface:IPrimitiveArrayGet the primitive Java array. The return value can be cast into the correct component type, e.g.if (char.class == array.getComponentType()) { char[] content = (char[]) array.getValueArray(); System.out.println(content.length); }The return value must not be modified because it is cached by the heap dump adapter. This method does not return a copy of the array for performance reasons.- Specified by:
getValueArrayin interfaceIPrimitiveArray- Returns:
- the contents of the primitive array
-
getValueArray
Description copied from interface:IPrimitiveArrayGet the primitive Java array, beginning atoffsetandlengthnumber of elements.The return value must not be modified because it is cached by the heap dump adapter. This method does not return a copy of the array for performance reasons.
- Specified by:
getValueArrayin interfaceIPrimitiveArray- Parameters:
offset- the starting indexlength- the number of entries- Returns:
- the contents of the primitive array starting at the index for length entries
-
getReferences
Description copied from class:AbstractObjectImplGets the outbound references from this object, as addresses.- Specified by:
getReferencesin classAbstractObjectImpl- Returns:
- a list of outbound references
-
getOutboundReferences
Description copied from interface:IObjectGet list of snapshot objects referenced from this snapshot object with the name of the field over which it was referenced.- Specified by:
getOutboundReferencesin interfaceIObject- Returns:
- list of snapshot objects referenced from this snapshot object with the name of the field over which it was referenced
-
getUsedHeapSize
public long getUsedHeapSize()Description copied from interface:IObjectGet used heap size of just this object.- Specified by:
getUsedHeapSizein interfaceIObject- Specified by:
getUsedHeapSizein classAbstractObjectImpl- Returns:
- used heap size of this object
-
doGetUsedHeapSize
Calculates the size of a primitive array- Parameters:
clazz- the typelength- the length in elementstype- the actual typeIObject.Type- Returns:
- the size in bytes
- Since:
- 1.0
-