HeapSegment

public final class HeapSegment
extends Object

java.lang.Object
   ↳ com.android.tradefed.device.server.HeapSegment


Describes the types and locations of objects in a segment of a heap.

Summary

Nested classes

class HeapSegment.HeapSegmentElement

Describes an object/region encoded in the HPSG data. 

Fields

protected int mAllocationUnitCount

protected int mAllocationUnitSize

protected int mHeapId

protected int mOffset

protected long mStartAddress

protected ByteBuffer mUsageData

Public constructors

HeapSegment(ByteBuffer hpsgData)

Create a new HeapSegment based on the raw contents of an HPSG chunk.

Public methods

boolean append(HeapSegment other)

Append the contents of other to this segment if it describes the segment immediately after this one.

boolean canAppend(HeapSegment other)

See if other comes immediately after this segment.

int compareTo(HeapSegment other)
boolean equals(Object o)
long getEndAddress()
int getLength()
HeapSegment.HeapSegmentElement getNextElement(HeapSegment.HeapSegmentElement reuse)
long getStartAddress()
int hashCode()
boolean isValid()

See if this segment still contains data, and has not been appended to another segment.

void rewindElements()
String toString()

Fields

mAllocationUnitCount

protected int mAllocationUnitCount

mAllocationUnitSize

protected int mAllocationUnitSize

mHeapId

protected int mHeapId

mOffset

protected int mOffset

mStartAddress

protected long mStartAddress

mUsageData

protected ByteBuffer mUsageData

Public constructors

HeapSegment

public HeapSegment (ByteBuffer hpsgData)

Create a new HeapSegment based on the raw contents of an HPSG chunk.

Parameters
hpsgData ByteBuffer: The raw data from an HPSG chunk.

Throws
if hpsgData is too small to hold the HPSG chunk header data.

Public methods

append

public boolean append (HeapSegment other)

Append the contents of other to this segment if it describes the segment immediately after this one.

Parameters
other HeapSegment: The segment to append to this segment, if possible. If appended, other will be invalid when this method returns.

Returns
boolean true if other was successfully appended to this segment.

canAppend

public boolean canAppend (HeapSegment other)

See if other comes immediately after this segment.

Parameters
other HeapSegment: The HeapSegment to check.

Returns
boolean true if other comes immediately after this segment.

compareTo

public int compareTo (HeapSegment other)

Parameters
other HeapSegment

Returns
int

equals

public boolean equals (Object o)

Parameters
o Object

Returns
boolean

getEndAddress

public long getEndAddress ()

Returns
long

getLength

public int getLength ()

Returns
int

getNextElement

public HeapSegment.HeapSegmentElement getNextElement (HeapSegment.HeapSegmentElement reuse)

Parameters
reuse HeapSegment.HeapSegmentElement

Returns
HeapSegment.HeapSegmentElement

getStartAddress

public long getStartAddress ()

Returns
long

hashCode

public int hashCode ()

Returns
int

isValid

public boolean isValid ()

See if this segment still contains data, and has not been appended to another segment.

Returns
boolean true if this segment has not been appended to another segment.

rewindElements

public void rewindElements ()

toString

public String toString ()

Returns
String