示例#1
0
  /** Return the index of a UTF entry or -1 if it doesn't exist. */
  int findUtf8(String value) {

    ConstantPoolEntry item = findMatchingEntry(value);
    if (item == null) return -1;

    return item.getIndex();
  }
示例#2
0
 /**
  * Add an entry, but only if it doesn't exist.
  *
  * @return the constant pool index of the added or existing item.
  */
 private int addDirectEntry(ConstantPoolEntry item) {
   ConstantPoolEntry existingItem = findMatchingEntry(item);
   if (existingItem != null) {
     item = existingItem;
     // foundCount++;
   } else {
     addEntry(item.getKey(), item);
   }
   return item.getIndex();
 }
示例#3
0
  /** Add an index reference. */
  private int addIndexReference(int tag, int i1, int i2) {

    // search for the item using the pre-allocated object
    searchIndex.set(tag, i1, i2);

    ConstantPoolEntry item = findMatchingEntry(searchIndex);

    if (item == null) {
      item = new CONSTANT_Index_info(tag, i1, i2);
      addEntry(item.getKey(), item);
    }

    return item.getIndex();
  }