|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.android.dx.dex.file.Item
com.android.dx.dex.file.OffsettedItem
public abstract class OffsettedItem
An item in a Dalvik file which is referenced by absolute offset.
| Constructor Summary | |
|---|---|
OffsettedItem(int alignment,
int writeSize)
Constructs an instance. |
|
| Method Summary | |
|---|---|
int |
compareTo(OffsettedItem other)
Comparisons for this class are defined to be class-major (if the classes don't match then the objects are not equal), with compareTo0(com.android.dx.dex.file.OffsettedItem) deciding same-class comparisons. |
protected int |
compareTo0(OffsettedItem other)
Compares this instance to another which is guaranteed to be of the same class. |
boolean |
equals(Object other)
Comparisons for this class are defined to be type-major (if the types don't match then the objects are not equal), with compareTo0(com.android.dx.dex.file.OffsettedItem) deciding same-type comparisons. |
int |
getAbsoluteOffset()
Gets the absolute item offset. |
static int |
getAbsoluteOffsetOr0(OffsettedItem item)
Gets the absolute offset of the given item, returning 0
if handed null. |
int |
getAlignment()
Gets the alignment requirement of this instance. |
int |
getRelativeOffset()
Gets the relative item offset. |
String |
offsetString()
Gets the absolute offset of this item as a string, suitable for including in annotations. |
int |
place(Section addedTo,
int offset)
Indicates that this item has been added to the given section at the given offset. |
protected void |
place0(Section addedTo,
int offset)
Does additional work required when placing an instance. |
void |
setWriteSize(int writeSize)
Sets the write size of this item. |
abstract String |
toHuman()
Gets a short human-readable string representing this instance. |
int |
writeSize()
Gets the size of this instance when written, in bytes. |
void |
writeTo(DexFile file,
AnnotatedOutput out)
Writes the representation of this instance to the given data section, using the given DexFile to look things up as needed. |
protected abstract void |
writeTo0(DexFile file,
AnnotatedOutput out)
Performs the actual write of the contents of this instance to the given data section. |
| Methods inherited from class com.android.dx.dex.file.Item |
|---|
addContents, itemType, typeName |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OffsettedItem(int alignment,
int writeSize)
alignment - > 0; output alignment requirement; must be a
power of 2writeSize - >= -1; the size of this instance when written,
in bytes, or -1 if not immediately known| Method Detail |
|---|
public static int getAbsoluteOffsetOr0(OffsettedItem item)
0
if handed null.
item - null-ok; the item in question
>= 0; the item's absolute offset, or 0
if item == nullpublic final boolean equals(Object other)
compareTo0(com.android.dx.dex.file.OffsettedItem) deciding same-type comparisons.
equals in class Objectpublic final int compareTo(OffsettedItem other)
compareTo0(com.android.dx.dex.file.OffsettedItem) deciding same-class comparisons.
compareTo in interface Comparable<OffsettedItem>public final void setWriteSize(int writeSize)
writeSize - > 0; the write size, in bytespublic final int writeSize()
writeSize in class Item>= 0; the write size
UnsupportedOperationException - thrown if the write size
is not yet known
public final void writeTo(DexFile file,
AnnotatedOutput out)
DexFile to look things up as needed.
If this instance keeps track of its offset, then this method will
note the written offset and will also throw an exception if this
instance has already been written.
writeTo in class Itemfile - non-null; the file to use for referenceout - non-null; where to write topublic final int getRelativeOffset()
>= 0; the offset
RuntimeException - thrown if the offset is not yet knownpublic final int getAbsoluteOffset()
>= 0; the offset
RuntimeException - thrown if the offset is not yet known
public final int place(Section addedTo,
int offset)
addedTo - non-null; the section this instance has
been added tooffset - >= 0; the desired offset from the start of the
section where this instance was placed
>= 0; the offset that this instance should be placed at
in order to meet its alignment constraintpublic final int getAlignment()
> 0; the alignment requirement; must be a power of 2public final String offsetString()
non-null; the offset stringpublic abstract String toHuman()
non-null; the human formprotected int compareTo0(OffsettedItem other)
other - non-null; instance to compare to
-1, 0, or 1, depending
on the sort order of this instance and the other
protected void place0(Section addedTo,
int offset)
addedTo - non-null; the section this instance has been added tooffset - >= 0; the offset from the start of the
section where this instance was placed
protected abstract void writeTo0(DexFile file,
AnnotatedOutput out)
writeTo(com.android.dx.dex.file.DexFile, com.android.dx.util.AnnotatedOutput),
which will have taken care of ensuring alignment.
file - non-null; the file to use for referenceout - non-null; where to write to
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||