com.android.dx.dex.file
Class StringIdsSection

java.lang.Object
  extended by com.android.dx.dex.file.Section
      extended by com.android.dx.dex.file.UniformItemSection
          extended by com.android.dx.dex.file.StringIdsSection

public final class StringIdsSection
extends UniformItemSection

Strings list section of a .dex file.


Constructor Summary
StringIdsSection(DexFile file)
          Constructs an instance.
 
Method Summary
 IndexedItem get(Constant cst)
          Gets the item corresponding to the given Constant.
 int indexOf(CstString string)
          Gets the index of the given string, which must have been added to this instance.
 void intern(CstNat nat)
          Interns the components of a name-and-type into this instance.
 StringIdItem intern(CstString string)
          Interns an element into this instance.
 StringIdItem intern(String string)
          Interns an element into this instance.
 StringIdItem intern(StringIdItem string)
          Interns an element into this instance.
 Collection<? extends Item> items()
          Gets the collection of all the items in this section.
protected  void orderItems()
          Alters or picks the order for items in this instance if desired, so that subsequent calls to Section.items() will yield a so-ordered collection.
 void writeHeaderPart(AnnotatedOutput out)
          Writes the portion of the file header that refers to this instance.
 
Methods inherited from class com.android.dx.dex.file.UniformItemSection
getAbsoluteItemOffset, prepare0, writeSize, writeTo0
 
Methods inherited from class com.android.dx.dex.file.Section
align, getAbsoluteOffset, getAlignment, getFile, getFileOffset, getName, prepare, setFileOffset, throwIfNotPrepared, throwIfPrepared, validateAlignment, writeTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringIdsSection

public StringIdsSection(DexFile file)
Constructs an instance. The file offset is initially unknown.

Parameters:
file - non-null; file that this instance is part of
Method Detail

items

public Collection<? extends Item> items()
Gets the collection of all the items in this section. It is not valid to attempt to change the returned list.

Specified by:
items in class Section
Returns:
non-null; the items

get

public 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.

Specified by:
get in class UniformItemSection
Parameters:
cst - non-null; constant to look for
Returns:
non-null; the corresponding item found in this instance

writeHeaderPart

public void writeHeaderPart(AnnotatedOutput out)
Writes the portion of the file header that refers to this instance.

Parameters:
out - non-null; where to write

intern

public StringIdItem intern(String string)
Interns an element into this instance.

Parameters:
string - non-null; the string to intern, as a regular Java String
Returns:
non-null; the interned string

intern

public StringIdItem intern(CstString string)
Interns an element into this instance.

Parameters:
string - non-null; the string to intern, as a constant
Returns:
non-null; the interned string

intern

public StringIdItem intern(StringIdItem string)
Interns an element into this instance.

Parameters:
string - non-null; the string to intern
Returns:
non-null; the interned string

intern

public void intern(CstNat nat)
Interns the components of a name-and-type into this instance.

Parameters:
nat - non-null; the name-and-type

indexOf

public int indexOf(CstString string)
Gets the index of the given string, which must have been added to this instance.

Parameters:
string - non-null; the string to look up
Returns:
>= 0; the string's index

orderItems

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

Specified by:
orderItems in class UniformItemSection


Copyright © 2013. All Rights Reserved.