|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.android.dx.dex.file.Section
public abstract class Section
A section of a .dex file. Each section consists of a list
of items of some sort or other.
| Constructor Summary | |
|---|---|
Section(String name,
DexFile file,
int alignment)
Constructs an instance. |
|
| Method Summary | |
|---|---|
protected void |
align(AnnotatedOutput out)
Aligns the output of the given data to the alignment of this instance. |
abstract int |
getAbsoluteItemOffset(Item item)
Returns the absolute file offset of the given item which must be contained in this section. |
int |
getAbsoluteOffset(int relative)
Returns the absolute file offset, given an offset from the start of this instance's output. |
int |
getAlignment()
Gets the alignment for this instance's final output. |
DexFile |
getFile()
Gets the file that this instance is part of. |
int |
getFileOffset()
Gets the offset from the start of the file to this part. |
protected String |
getName()
Returns the name of this section, for annotation purposes. |
abstract Collection<? extends Item> |
items()
Gets the collection of all the items in this section. |
void |
prepare()
Prepares this instance for writing. |
protected abstract void |
prepare0()
Does the main work of prepare(). |
int |
setFileOffset(int fileOffset)
Sets the file offset. |
protected void |
throwIfNotPrepared()
Throws an exception if prepare() has not been
called on this instance. |
protected void |
throwIfPrepared()
Throws an exception if prepare() has already been called
on this instance. |
static void |
validateAlignment(int alignment)
Validates an alignment. |
abstract int |
writeSize()
Gets the size of this instance when output, in bytes. |
void |
writeTo(AnnotatedOutput out)
Writes this instance to the given raw data object. |
protected abstract void |
writeTo0(AnnotatedOutput out)
Writes this instance to the given raw data object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Section(String name,
DexFile file,
int alignment)
name - null-ok; the name of this instance, for annotation
purposesfile - non-null; file that this instance is part ofalignment - > 0; alignment requirement for the final output;
must be a power of 2| Method Detail |
|---|
public static void validateAlignment(int alignment)
alignment - the alignment
IllegalArgumentException - thrown if alignment
isn't a positive power of 2public final DexFile getFile()
non-null; the filepublic final int getAlignment()
> 0; the alignmentpublic final int getFileOffset()
>= 0; the file offsetpublic final int setFileOffset(int fileOffset)
fileOffset - >= 0; the desired offset from the start of the
file where this for this instance
>= 0; the offset that this instance should be placed at
in order to meet its alignment constraintpublic final void writeTo(AnnotatedOutput out)
out - non-null; where to write topublic final int getAbsoluteOffset(int relative)
setFileOffset(int)).
relative - >= 0; the relative offset
>= 0; the corresponding absolute file offsetpublic abstract int getAbsoluteItemOffset(Item item)
setFileOffset(int)).
Note: Subclasses must implement this as appropriate for their contents.
item - non-null; the item in question
>= 0; the item's absolute file offsetpublic final void prepare()
public abstract Collection<? extends Item> items()
non-null; the itemsprotected abstract void prepare0()
prepare().
public abstract int writeSize()
>= 0; the size of this instance, in bytesprotected final void throwIfNotPrepared()
prepare() has not been
called on this instance.
protected final void throwIfPrepared()
prepare() has already been called
on this instance.
protected final void align(AnnotatedOutput out)
out - non-null; the output to alignprotected abstract void writeTo0(AnnotatedOutput out)
writeTo(com.android.dx.util.AnnotatedOutput) after aligning the cursor of
out and verifying that either the assigned file
offset matches the actual cursor out or that the
file offset was not previously assigned, in which case it gets
assigned to out's cursor.
out - non-null; where to write toprotected final String getName()
null-ok; name of this part, for annotation purposes
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||