com.android.ddmlib
Class HeapSegment

java.lang.Object
  extended by com.android.ddmlib.HeapSegment
All Implemented Interfaces:
Comparable<HeapSegment>

public final class HeapSegment
extends Object
implements Comparable<HeapSegment>

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


Nested Class Summary
static class HeapSegment.HeapSegmentElement
          Describes an object/region encoded in the HPSG data.
 
Field Summary
protected  int mAllocationUnitCount
           
protected  int mAllocationUnitSize
           
protected  int mHeapId
           
protected  int mOffset
           
protected  long mStartAddress
           
protected  ByteBuffer mUsageData
           
 
Constructor Summary
HeapSegment(ByteBuffer hpsgData)
          Create a new HeapSegment based on the raw contents of an HPSG chunk.
 
Method Summary
 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()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

mHeapId

protected int mHeapId

mAllocationUnitSize

protected int mAllocationUnitSize

mStartAddress

protected long mStartAddress

mOffset

protected int mOffset

mAllocationUnitCount

protected int mAllocationUnitCount

mUsageData

protected ByteBuffer mUsageData
Constructor Detail

HeapSegment

public HeapSegment(ByteBuffer hpsgData)
            throws BufferUnderflowException
Create a new HeapSegment based on the raw contents of an HPSG chunk.

Parameters:
hpsgData - The raw data from an HPSG chunk.
Throws:
BufferUnderflowException - if hpsgData is too small to hold the HPSG chunk header data.
Method Detail

isValid

public boolean isValid()
See if this segment still contains data, and has not been appended to another segment.

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

canAppend

public boolean canAppend(HeapSegment other)
See if other comes immediately after this segment.

Parameters:
other - The HeapSegment to check.
Returns:
true if other comes immediately after this segment.

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 - The segment to append to this segment, if possible. If appended, other will be invalid when this method returns.
Returns:
true if other was successfully appended to this segment.

getStartAddress

public long getStartAddress()

getLength

public int getLength()

getEndAddress

public long getEndAddress()

rewindElements

public void rewindElements()

getNextElement

public HeapSegment.HeapSegmentElement getNextElement(HeapSegment.HeapSegmentElement reuse)

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(HeapSegment other)
Specified by:
compareTo in interface Comparable<HeapSegment>


Copyright © 2008-2012. All Rights Reserved.