|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.android.dx.dex.file.Section
com.android.dx.dex.file.MixedItemSection
public final class MixedItemSection
A section of a .dex file which consists of a sequence of
OffsettedItem objects, which may each be of a different concrete
class and/or size.
Note: It is invalid for an item in an instance of this class to
have a larger alignment requirement than the alignment of this instance.
| Constructor Summary | |
|---|---|
MixedItemSection(String name,
DexFile file,
int alignment,
com.android.dx.dex.file.MixedItemSection.SortType sort)
Constructs an instance. |
|
| Method Summary | ||
|---|---|---|
void |
add(OffsettedItem item)
Adds an item to this instance. |
|
|
get(T item)
Gets an item which was previously interned. |
|
int |
getAbsoluteItemOffset(Item item)
Returns the absolute file offset of the given item which must be contained in this section. |
|
|
intern(T item)
Interns an item in this instance, returning the interned instance (which may not be the one passed in). |
|
Collection<? extends Item> |
items()
Gets the collection of all the items in this section. |
|
void |
placeItems()
Places all the items in this instance at particular offsets. |
|
protected void |
prepare0()
Does the main work of Section.prepare(). |
|
int |
size()
Gets the size of this instance, in items. |
|
void |
writeHeaderPart(AnnotatedOutput out)
Writes the portion of the file header that refers to this instance. |
|
void |
writeIndexAnnotation(AnnotatedOutput out,
ItemType itemType,
String intro)
Writes an index of contents of the items in this instance of the given type. |
|
int |
writeSize()
Gets the size of this instance when output, in bytes. |
|
protected void |
writeTo0(AnnotatedOutput out)
Writes this instance to the given raw data object. |
|
| Methods inherited from class com.android.dx.dex.file.Section |
|---|
align, getAbsoluteOffset, getAlignment, getFile, getFileOffset, getName, prepare, setFileOffset, throwIfNotPrepared, throwIfPrepared, validateAlignment, writeTo |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MixedItemSection(String name,
DexFile file,
int alignment,
com.android.dx.dex.file.MixedItemSection.SortType sort)
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 2sort - how the items should be sorted in the final output| Method Detail |
|---|
public Collection<? extends Item> items()
items in class Sectionnon-null; the itemspublic int writeSize()
writeSize in class Section>= 0; the size of this instance, in bytespublic int getAbsoluteItemOffset(Item item)
Section.setFileOffset(int)).
Note: Subclasses must implement this as appropriate for their contents.
getAbsoluteItemOffset in class Sectionitem - non-null; the item in question
>= 0; the item's absolute file offsetpublic int size()
>= 0; the sizepublic void writeHeaderPart(AnnotatedOutput out)
out - non-null; where to writepublic void add(OffsettedItem item)
item - non-null; the item to addpublic <T extends OffsettedItem> T intern(T item)
item - non-null; the item to intern
non-null; the equivalent interned instancepublic <T extends OffsettedItem> T get(T item)
item - non-null; the item to look for
non-null; the equivalent already-interned instance
public void writeIndexAnnotation(AnnotatedOutput out,
ItemType itemType,
String intro)
out - non-null; where to write toitemType - non-null; the item type of interestintro - non-null; the introductory string for non-empty indicesprotected void prepare0()
Section.prepare().
prepare0 in class Sectionpublic void placeItems()
OffsettedItem.place(com.android.dx.dex.file.Section, int) on each item. If an item
does not know its write size before the call to place,
it is that call which is responsible for setting the write size.
This method may only be called once per instance; subsequent calls
will throw an exception.
protected void writeTo0(AnnotatedOutput out)
Section.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.
writeTo0 in class Sectionout - non-null; where to write to
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||