public final class HeapSegment extends java.lang.Object implements java.lang.Comparable<HeapSegment>
| Modifier and Type | Class and Description |
|---|---|
static class |
HeapSegment.HeapSegmentElement
Describes an object/region encoded in the HPSG data.
|
| Modifier and Type | Field and Description |
|---|---|
protected int |
mAllocationUnitCount |
protected int |
mAllocationUnitSize |
protected int |
mHeapId |
protected int |
mOffset |
protected long |
mStartAddress |
protected java.nio.ByteBuffer |
mUsageData |
| Constructor and Description |
|---|
HeapSegment(java.nio.ByteBuffer hpsgData)
Create a new HeapSegment based on the raw contents
of an HPSG chunk.
|
| Modifier and Type | Method and Description |
|---|---|
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(java.lang.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() |
java.lang.String |
toString() |
protected int mHeapId
protected int mAllocationUnitSize
protected long mStartAddress
protected int mOffset
protected int mAllocationUnitCount
protected java.nio.ByteBuffer mUsageData
public HeapSegment(java.nio.ByteBuffer hpsgData)
throws java.nio.BufferUnderflowException
hpsgData - The raw data from an HPSG chunk.java.nio.BufferUnderflowException - if hpsgData is too small
to hold the HPSG chunk header data.public boolean isValid()
public boolean canAppend(HeapSegment other)
other comes immediately after this segment.other - The HeapSegment to check.other comes immediately after this
segment.public boolean append(HeapSegment other)
other to this segment
if it describes the segment immediately after this one.other - The segment to append to this segment, if possible.
If appended, other will be invalid
when this method returns.other was successfully appended to
this segment.public long getStartAddress()
public int getLength()
public long getEndAddress()
public void rewindElements()
public HeapSegment.HeapSegmentElement getNextElement(HeapSegment.HeapSegmentElement reuse)
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(@NonNull
HeapSegment other)
compareTo in interface java.lang.Comparable<HeapSegment>