com.android.dx.dex.file
Class StringIdItem

java.lang.Object
  extended by com.android.dx.dex.file.Item
      extended by com.android.dx.dex.file.IndexedItem
          extended by com.android.dx.dex.file.StringIdItem
All Implemented Interfaces:
Comparable

public final class StringIdItem
extends IndexedItem
implements Comparable

Representation of a string inside a Dalvik file.


Constructor Summary
StringIdItem(CstString value)
          Constructs an instance.
 
Method Summary
 void addContents(DexFile file)
          Populates a DexFile with items from within this instance.
 int compareTo(Object other)
          
 boolean equals(Object other)
          
 StringDataItem getData()
          Gets the associated data object for this instance, if known.
 CstString getValue()
          Gets the string value.
 int hashCode()
          
 ItemType itemType()
          Returns the item type for this instance.
 int writeSize()
          Gets the size of this instance when written, in bytes.
 void writeTo(DexFile file, AnnotatedOutput out)
          Writes the representation of this instance to the given data section, using the given DexFile to look things up as needed.
 
Methods inherited from class com.android.dx.dex.file.IndexedItem
getIndex, hasIndex, indexString, setIndex
 
Methods inherited from class com.android.dx.dex.file.Item
typeName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringIdItem

public StringIdItem(CstString value)
Constructs an instance.

Parameters:
value - non-null; the string value
Method Detail

equals

public boolean equals(Object other)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

compareTo

public int compareTo(Object other)

Specified by:
compareTo in interface Comparable

itemType

public ItemType itemType()
Returns the item type for this instance.

Specified by:
itemType in class Item
Returns:
non-null; the item type

writeSize

public int writeSize()
Gets the size of this instance when written, in bytes.

Specified by:
writeSize in class Item
Returns:
>= 0; the write size

addContents

public void addContents(DexFile file)
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.

Specified by:
addContents in class Item
Parameters:
file - non-null; the file to populate

writeTo

public void writeTo(DexFile file,
                    AnnotatedOutput out)
Writes the representation of this instance to the given data section, using the given DexFile to look things up as needed. If this instance keeps track of its offset, then this method will note the written offset and will also throw an exception if this instance has already been written.

Specified by:
writeTo in class Item
Parameters:
file - non-null; the file to use for reference
out - non-null; where to write to

getValue

public CstString getValue()
Gets the string value.

Returns:
non-null; the value

getData

public StringDataItem getData()
Gets the associated data object for this instance, if known.

Returns:
null-ok; the associated data object or null if not yet known


Copyright © 2015. All rights reserved.