Add a convenience method that accepts a string instead of a StringIdItem

git-svn-id: https://smali.googlecode.com/svn/trunk@414 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com 2009-08-24 05:48:14 +00:00
parent 3687f27ddd
commit c74042b943

View File

@ -58,6 +58,7 @@ public class TypeIdItem extends Item<TypeIdItem> {
* the given <code>DexFile</code>
* @param dexFile The <code>DexFile</code> that this item will belong to
* @param typeDescriptor The <code>StringIdItem</code> containing the type descriptor that
* this <code>TypeIdItem</code> represents
* @return a <code>TypeIdItem</code> for the given values, and that has been interned into
* the given <code>DexFile</code>
*/
@ -66,6 +67,20 @@ public class TypeIdItem extends Item<TypeIdItem> {
return dexFile.TypeIdsSection.intern(typeIdItem);
}
/**
* Returns a <code>TypeIdItem</code> for the given values, and that has been interned into
* the given <code>DexFile</code>
* @param dexFile The <code>DexFile</code> that this item will belong to
* @param typeDescriptor The string containing the type descriptor that this
* <code>TypeIdItem</code> represents
* @return a <code>TypeIdItem</code> for the given values, and that has been interned into
* the given <code>DexFile</code>
*/
public static TypeIdItem getInternedTypeIdItem(DexFile dexFile, String typeDescriptor) {
TypeIdItem typeIdItem = new TypeIdItem(dexFile, StringIdItem.getInternedStringIdItem(dexFile, typeDescriptor));
return dexFile.TypeIdsSection.intern(typeIdItem);
}
/** {@inheritDoc} */
protected void readItem(Input in, ReadContext readContext) {
int stringIdIndex = in.readInt();