Top Description Constructors Methods
org.droidparts.dexmaker.dx.dex.file

public abstract Class UniformItemSection

extends Section
Class Inheritance
Known Direct Subclasses
org.droidparts.dexmaker.dx.dex.file.ClassDefsSection, org.droidparts.dexmaker.dx.dex.file.HeaderSection, org.droidparts.dexmaker.dx.dex.file.MemberIdsSection, org.droidparts.dexmaker.dx.dex.file.ProtoIdsSection, org.droidparts.dexmaker.dx.dex.file.StringIdsSection, org.droidparts.dexmaker.dx.dex.file.TypeIdsSection
Imports
org.droidparts.dexmaker.dx.rop.cst.Constant, org.droidparts.dexmaker.dx.util.AnnotatedOutput, java.util.Collection

A section of a .dex file which consists of a sequence of Item objects. Each of the items must have the same size in the output.

Constructor Summary

AccessConstructor and Description
public
UniformItemSection(String
null-ok; the name of this instance, for annotation purposes
name
,
DexFile
non-null; file that this instance is part of
file
,
int
> 0; alignment requirement for the final output; must be a power of 2
alignment
)

Constructs an instance.

Method Summary

Modifier and TypeMethod and Description
public abstract IndexedItem

Returns:

non-null; the corresponding item found in this instance
get
(Constant
non-null; constant to look for
cst
)

Gets the item corresponding to the given Constant.

public final int
getAbsoluteItemOffset(Item
non-null; the item in question
item
)

Implements abstract org.droidparts.dexmaker.dx.dex.file.Section.getAbsoluteItemOffset.

Returns the absolute file offset of the given item which must be contained in this section.
protected abstract void
orderItems()

Alters or picks the order for items in this instance if desired, so that subsequent calls to items will yield a so-ordered collection.

protected final void
prepare0()

Implements abstract org.droidparts.dexmaker.dx.dex.file.Section.prepare0.

Does the main work of prepare.
public final int
writeSize()

Implements abstract org.droidparts.dexmaker.dx.dex.file.Section.writeSize.

Gets the size of this instance when output, in bytes.
protected final void
writeTo0(AnnotatedOutput
non-null; where to write to
out
)

Implements abstract org.droidparts.dexmaker.dx.dex.file.Section.writeTo0.

Writes this instance to the given raw data object.
Inherited from org.droidparts.dexmaker.dx.dex.file.Section:
aligngetAbsoluteOffsetgetAlignmentgetFilegetFileOffsetgetNameitemspreparesetFileOffsetthrowIfNotPreparedthrowIfPreparedvalidateAlignmentwriteTo

Constructor Detail

UniformItemSectionback to summary
public UniformItemSection(String name, DexFile file, int alignment)

Constructs an instance. The file offset is initially unknown.

Parameters
name:String

null-ok; the name of this instance, for annotation purposes

file:DexFile

non-null; file that this instance is part of

alignment:int

> 0; alignment requirement for the final output; must be a power of 2

Method Detail

getback to summary
public abstract IndexedItem get(Constant cst)

Gets the item corresponding to the given Constant. This will throw an exception if the constant is not found, including if this instance isn't the sort that maps constants to IndexedItem instances.

Parameters
cst:Constant

non-null; constant to look for

Returns:IndexedItem

non-null; the corresponding item found in this instance

getAbsoluteItemOffsetback to summary
public final int getAbsoluteItemOffset(Item item)

Implements abstract org.droidparts.dexmaker.dx.dex.file.Section.getAbsoluteItemOffset.

Doc from org.droidparts.dexmaker.dx.dex.file.Section.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 (via setFileOffset).

Note

Subclasses must implement this as appropriate for their contents.

Parameters
item:Item

non-null; the item in question

Returns:int

>= 0; the item's absolute file offset

Annotations
@Override
orderItemsback to summary
protected abstract void orderItems()

Alters or picks the order for items in this instance if desired, so that subsequent calls to items will yield a so-ordered collection. If the items in this instance are indexed, then this method should also assign indices.

prepare0back to summary
protected final void prepare0()

Implements abstract org.droidparts.dexmaker.dx.dex.file.Section.prepare0.

Doc from org.droidparts.dexmaker.dx.dex.file.Section.prepare0.

Does the main work of prepare.

Annotations
@Override
writeSizeback to summary
public final int writeSize()

Implements abstract org.droidparts.dexmaker.dx.dex.file.Section.writeSize.

Doc from org.droidparts.dexmaker.dx.dex.file.Section.writeSize.

Gets the size of this instance when output, in bytes.

Returns:int

>= 0; the size of this instance, in bytes

Annotations
@Override
writeTo0back to summary
protected final void writeTo0(AnnotatedOutput out)

Implements abstract org.droidparts.dexmaker.dx.dex.file.Section.writeTo0.

Doc from org.droidparts.dexmaker.dx.dex.file.Section.writeTo0.

Writes this instance to the given raw data object. This gets called by writeTo 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.

Parameters
out:AnnotatedOutput

non-null; where to write to

Annotations
@Override