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

public final Class StringDataItem

extends OffsettedItem
Class Inheritance
Imports
org.droidparts.dexmaker.dx.rop.cst.CstString, org.droidparts.dexmaker.dx.util.AnnotatedOutput, .ByteArray, .Hex, .Leb128Utils

Representation of string data for a particular string, in a Dalvik file.

Field Summary

Modifier and TypeField and Description
private final CstString
value

non-null; the string value

Constructor Summary

AccessConstructor and Description
public
StringDataItem(CstString
non-null; the string value
value
)

Constructs an instance.

Method Summary

Modifier and TypeMethod and Description
public void
addContents(DexFile
non-null; the file to populate
file
)

Implements abstract org.droidparts.dexmaker.dx.dex.file.Item.addContents.

Populates a DexFile with items from within this instance.
protected int
compareTo0(OffsettedItem
non-null; instance to compare to
other
)

Overrides org.droidparts.dexmaker.dx.dex.file.OffsettedItem.compareTo0.

Compares this instance to another which is guaranteed to be of the same class.
public ItemType
itemType()

Implements abstract org.droidparts.dexmaker.dx.dex.file.Item.itemType.

Returns the item type for this instance.
public String
toHuman()

Implements abstract org.droidparts.dexmaker.dx.dex.file.OffsettedItem.toHuman.

Gets a short human-readable string representing this instance.
private static int

Returns:

>= 2; the write size, in bytes
writeSize
(CstString
non-null; the string value
value
)

Gets the write size for a given value.

public void
writeTo0(DexFile
non-null; the file to use for reference
file
,
AnnotatedOutput
non-null; where to write to
out
)

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

Performs the actual write of the contents of this instance to the given data section.
Inherited from org.droidparts.dexmaker.dx.dex.file.OffsettedItem:
compareToequalsgetAbsoluteOffsetgetAbsoluteOffsetOr0getAlignmentgetRelativeOffsetoffsetStringplaceplace0setWriteSizewriteSizewriteTo

Field Detail

valueback to summary
private final CstString value

non-null; the string value

Constructor Detail

StringDataItemback to summary
public StringDataItem(CstString value)

Constructs an instance.

Parameters
value:CstString

non-null; the string value

Method Detail

addContentsback to summary
public void addContents(DexFile file)

Implements abstract org.droidparts.dexmaker.dx.dex.file.Item.addContents.

Doc from org.droidparts.dexmaker.dx.dex.file.Item.addContents.

Populates a DexFile with items from within this instance. This will not add an item to the file for this instance itself (which should have been done by whatever refers to this instance).

Note

Subclasses must override this to do something appropriate.

Parameters
file:DexFile

non-null; the file to populate

Annotations
@Override
compareTo0back to summary
protected int compareTo0(OffsettedItem other)

Overrides org.droidparts.dexmaker.dx.dex.file.OffsettedItem.compareTo0.

Doc from org.droidparts.dexmaker.dx.dex.file.OffsettedItem.compareTo0.

Compares this instance to another which is guaranteed to be of the same class. The default implementation of this method is to throw an exception (unsupported operation). If a particular class needs to actually sort, then it should override this method.

Parameters
other:OffsettedItem

non-null; instance to compare to

Returns:int

-1, 0, or 1, depending on the sort order of this instance and the other

Annotations
@Override
itemTypeback to summary
public ItemType itemType()

Implements abstract org.droidparts.dexmaker.dx.dex.file.Item.itemType.

Doc from org.droidparts.dexmaker.dx.dex.file.Item.itemType.

Returns the item type for this instance.

Returns:ItemType

non-null; the item type

Annotations
@Override
toHumanback to summary
public String toHuman()

Implements abstract org.droidparts.dexmaker.dx.dex.file.OffsettedItem.toHuman.

Doc from org.droidparts.dexmaker.dx.dex.file.OffsettedItem.toHuman.

Gets a short human-readable string representing this instance.

Returns:String

non-null; the human form

Annotations
@Override
writeSizeback to summary
private static int writeSize(CstString value)

Gets the write size for a given value.

Parameters
value:CstString

non-null; the string value

Returns:int

>= 2; the write size, in bytes

writeTo0back to summary
public void writeTo0(DexFile file, AnnotatedOutput out)

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

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

Performs the actual write of the contents of this instance to the given data section. This is called by writeTo, which will have taken care of ensuring alignment.

Parameters
file:DexFile

non-null; the file to use for reference

out:AnnotatedOutput

non-null; where to write to

Annotations
@Override