public final class MixedItemSection extends Section
.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 and Description |
|---|
MixedItemSection(java.lang.String name,
DexFile file,
int alignment,
com.android.dx.dex.file.MixedItemSection.SortType sort)
Constructs an instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(OffsettedItem item)
Adds an item to this instance.
|
<T extends OffsettedItem> |
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.
|
<T extends OffsettedItem> |
intern(T item)
Interns an item in this instance, returning the interned instance
(which may not be the one passed in).
|
java.util.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,
java.lang.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.
|
align, getAbsoluteOffset, getAlignment, getFile, getFileOffset, getName, prepare, setFileOffset, throwIfNotPrepared, throwIfPrepared, validateAlignment, writeTopublic MixedItemSection(java.lang.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 outputpublic java.util.Collection<? extends Item> items()
public int writeSize()
public 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 internnon-null; the equivalent interned instancepublic <T extends OffsettedItem> T get(T item)
item - non-null; the item to look fornon-null; the equivalent already-interned instancepublic void writeIndexAnnotation(AnnotatedOutput out, ItemType itemType, java.lang.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().public 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.Copyright © 2020. All Rights Reserved.