public abstract class OffsettedItem extends Item implements java.lang.Comparable<OffsettedItem>
| Constructor and Description |
|---|
OffsettedItem(int alignment,
int writeSize)
Constructs an instance.
|
| Modifier and Type | Method and Description |
|---|---|
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(java.lang.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.
|
java.lang.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 java.lang.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.
|
addContents, itemType, typeNamepublic 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 knownpublic 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(java.lang.Object other)
compareTo0(com.android.dx.dex.file.OffsettedItem) deciding same-type comparisons.equals in class java.lang.Objectpublic final int compareTo(OffsettedItem other)
compareTo0(com.android.dx.dex.file.OffsettedItem) deciding same-class comparisons.compareTo in interface java.lang.Comparable<OffsettedItem>public final void setWriteSize(int writeSize)
writeSize - > 0; the write size, in bytespublic final int writeSize()
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.public final int getRelativeOffset()
>= 0; the offsetjava.lang.RuntimeException - thrown if the offset is not yet knownpublic final int getAbsoluteOffset()
>= 0; the offsetjava.lang.RuntimeException - thrown if the offset is not yet knownpublic 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 java.lang.String offsetString()
non-null; the offset stringpublic abstract java.lang.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 otherprotected 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 placedprotected 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 toCopyright © 2020. All Rights Reserved.