|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectserp.bytecode.lowlevel.ConstantPool
public class ConstantPool
A bytecode constant pool, containing entries for all strings,
constants, classes, etc referenced in the class structure and method
opcodes. In keeping with the low-level bytecode representation, all pool
indexes are 1-based and LongEntrys and DoubleEntrys each
occupy two indexes in the pool.
| Constructor Summary | |
|---|---|
ConstantPool()
Default constructor. |
|
| Method Summary | |
|---|---|
void |
acceptVisit(BCVisitor visit)
Accept a visit from a BCVisitor, calling the appropriate methods
to notify the visitor that it has entered this entity, and
to provide it with the proper callbacks for each sub-entity owned
by this one. |
int |
addEntry(Entry entry)
Add an entry to the pool. |
void |
clear()
Clear all entries from the pool. |
int |
findClassEntry(String name,
boolean add)
Return the constant pool index of the ClassEntry for the given
class name, or 0 if it does not exist. |
int |
findDoubleEntry(double value,
boolean add)
Return the constant pool index of the DoubleEntry for the given
value, or 0 if it does not exist. |
int |
findFieldEntry(String owner,
String name,
String desc,
boolean add)
Return the constant pool index of the FieldEntry for the
given name, descriptor, and owner class name. |
int |
findFloatEntry(float value,
boolean add)
Return the constant pool index of the FloatEntry for the given
value, or 0 if it does not exist. |
int |
findIntEntry(int value,
boolean add)
Return the constant pool index of the IntEntry for the given
value, or 0 if it does not exist. |
int |
findInterfaceMethodEntry(String owner,
String name,
String desc,
boolean add)
Return the constant pool index of the InterfaceMethodEntry for
the given name, descriptor, and owner class name. |
int |
findLongEntry(long value,
boolean add)
Return the constant pool index of the LongEntry for the given
value, or 0 if it does not exist. |
int |
findMethodEntry(String owner,
String name,
String desc,
boolean add)
Return the constant pool index of the MethodEntry for the
given name, descriptor, and owner class name. |
int |
findNameAndTypeEntry(String name,
String desc,
boolean add)
Return the constant pool index of the NameAndTypeEntry for the
given name and descriptor, or 0 if it does not exist. |
int |
findStringEntry(String value,
boolean add)
Return the constant pool index of the StringEntry for the given
string value, or 0 if it does not exist. |
int |
findUTF8Entry(String value,
boolean add)
Return the index of the UTF8Entry with the given value, or
0 if it does not exist. |
Entry[] |
getEntries()
Return all the entries in the pool. |
Entry |
getEntry(int index)
Retrieve the entry at the specified 1-based index. |
int |
indexOf(Entry entry)
Return the index of the given entry, or 0 if it is not in the pool. |
void |
read(DataInput in)
Fill the constant pool from the given bytecode stream. |
boolean |
removeEntry(Entry entry)
Remove the given entry from the pool. |
int |
size()
Return the number of places occupied in the pool, including the fact that long and double entries occupy two places. |
void |
write(DataOutput out)
Write the constant pool to the given bytecode stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConstantPool()
| Method Detail |
|---|
public Entry[] getEntries()
public Entry getEntry(int index)
IndexOutOfBoundsException - if index is invalid,
including the case that it points to the second slot of a
long or double entrypublic int indexOf(Entry entry)
public int addEntry(Entry entry)
public boolean removeEntry(Entry entry)
public void clear()
public int size()
public int findUTF8Entry(String value,
boolean add)
UTF8Entry with the given value, or
0 if it does not exist.
add - if true, the entry will be added if it does not
already exist, and the new entry's index returned
public int findDoubleEntry(double value,
boolean add)
DoubleEntry for the given
value, or 0 if it does not exist.
value - the value to findadd - if true, the entry will be added if it does not
already exist, and the new entry's index returned
public int findFloatEntry(float value,
boolean add)
FloatEntry for the given
value, or 0 if it does not exist.
value - the value to findadd - if true, the entry will be added if it does not
already exist, and the new entry's index returned
public int findIntEntry(int value,
boolean add)
IntEntry for the given
value, or 0 if it does not exist.
value - the value to findadd - if true, the entry will be added if it does not
already exist, and the new entry's index returned
public int findLongEntry(long value,
boolean add)
LongEntry for the given
value, or 0 if it does not exist.
value - the value to findadd - if true, the entry will be added if it does not
already exist, and the new entry's index returned
public int findStringEntry(String value,
boolean add)
StringEntry for the given
string value, or 0 if it does not exist.
value - the value to findadd - if true, the entry will be added if it does not
already exist, and the new entry's index returned
public int findClassEntry(String name,
boolean add)
ClassEntry for the given
class name, or 0 if it does not exist.
name - the class name in internal formadd - if true, the entry will be added if it does not
already exist, and the new entry's index returned
public int findNameAndTypeEntry(String name,
String desc,
boolean add)
NameAndTypeEntry for the
given name and descriptor, or 0 if it does not exist.
name - the name of the entitydesc - the descriptor of the entity in internal formadd - if true, the entry will be added if it does not
already exist, and the new entry's index returned
public int findFieldEntry(String owner,
String name,
String desc,
boolean add)
FieldEntry for the
given name, descriptor, and owner class name.
owner - the name of the field's owning class in internal formname - the name of the fielddesc - the descriptor of the field in internal formadd - if true, the entry will be added if it does not
already exist, and the new entry's index returned
public int findMethodEntry(String owner,
String name,
String desc,
boolean add)
MethodEntry for the
given name, descriptor, and owner class name.
owner - the name of the method's owning class in internal formname - the name of the methoddesc - the descriptor of the method in internal formadd - if true, the entry will be added if it does not
already exist, and the new entry's index returned
public int findInterfaceMethodEntry(String owner,
String name,
String desc,
boolean add)
InterfaceMethodEntry for
the given name, descriptor, and owner class name.
owner - the name of the method's owning class in internal formname - the name of the methoddesc - the descriptor of the method in internal formadd - if true, the entry will be added if it does not
already exist, and the new entry's index returnedpublic void acceptVisit(BCVisitor visit)
VisitAcceptorBCVisitor, calling the appropriate methods
to notify the visitor that it has entered this entity, and
to provide it with the proper callbacks for each sub-entity owned
by this one.
acceptVisit in interface VisitAcceptor
public void read(DataInput in)
throws IOException
IOException
public void write(DataOutput out)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||