Class UniformItemSection
java.lang.Object
com.android.dx.dex.file.Section
com.android.dx.dex.file.UniformItemSection
- Direct Known Subclasses:
CallSiteIdsSection, ClassDefsSection, HeaderSection, MemberIdsSection, MethodHandlesSection, ProtoIdsSection, StringIdsSection, TypeIdsSection
-
Constructor Summary
ConstructorsConstructorDescriptionUniformItemSection(String name, DexFile file, int alignment) Constructs an instance. -
Method Summary
Modifier and TypeMethodDescriptionabstract IndexedItemGets the item corresponding to the givenConstant.final intgetAbsoluteItemOffset(Item item) Returns the absolute file offset of the given item which must be contained in this section.protected abstract voidAlters or picks the order for items in this instance if desired, so that subsequent calls toSection.items()will yield a so-ordered collection.protected final voidprepare0()Does the main work ofSection.prepare().final intGets the size of this instance when output, in bytes.protected final voidwriteTo0(AnnotatedOutput out) Writes this instance to the given raw data object.Methods inherited from class Section
align, getAbsoluteOffset, getAlignment, getFile, getFileOffset, getName, items, prepare, setFileOffset, throwIfNotPrepared, throwIfPrepared, validateAlignment, writeTo
-
Constructor Details
-
UniformItemSection
Constructs an instance. The file offset is initially unknown.- Parameters:
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 Details
-
writeSize
-
get
Gets the item corresponding to the givenConstant. This will throw an exception if the constant is not found, including if this instance isn't the sort that maps constants toIndexedIteminstances.- Parameters:
cst-non-null;constant to look for- Returns:
non-null;the corresponding item found in this instance
-
prepare0
protected final void prepare0()Does the main work ofSection.prepare(). -
writeTo0
Writes this instance to the given raw data object. This gets called bySection.writeTo(AnnotatedOutput)after aligning the cursor ofoutand verifying that either the assigned file offset matches the actual cursoroutor that the file offset was not previously assigned, in which case it gets assigned toout's cursor. -
getAbsoluteItemOffset
Returns the absolute file offset of the given item which must be contained in this section. This is only valid to call once this instance has been assigned a file offset (viaSection.setFileOffset(int)).Note: Subclasses must implement this as appropriate for their contents.
- Specified by:
getAbsoluteItemOffsetin classSection- Parameters:
item-non-null;the item in question- Returns:
>= 0;the item's absolute file offset
-
orderItems
protected abstract void orderItems()Alters or picks the order for items in this instance if desired, so that subsequent calls toSection.items()will yield a so-ordered collection. If the items in this instance are indexed, then this method should also assign indices.
-