| Modifier and Type | Field and Description |
|---|---|
| private final List | entries
The entries in the constant pool. |
| private final Map | utf8Indexes
A Hashtable of UTF8 entries - used to get constant pool indexes of the UTF8 values quickly |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: the index into the constant pool at which the entry is stored.the new entry to be added to the constant pool. entry)Add an entry to the constant pool. |
| public int | Returns: the index at which the given class entry occurs in the constant pool or -1 if the value does not occur.the name of the class for which the class entry
index is required. className)Get the index of a given CONSTANT_CLASS entry in the constant pool. |
| public int | Returns: the index at which the given value entry occurs in the constant pool or -1 if the value does not occur.the constant value for which the index is
required. constantValue)Get the index of a given constant value entry in the constant pool. |
| public ConstantPoolEntry | Returns: the constant pool entry at that index.the index into the constant pool. index)Get an constant pool entry at a particular index. |
| public int | Returns: the index at which the given field ref entry occurs in the constant pool or -1 if the value does not occur.the name of the class which contains the field
being referenced. fieldClassName, String the name of the field being referenced. fieldName, String the type descriptor of the field being referenced. fieldType)Get the index of a given CONSTANT_FIELDREF entry in the constant pool. |
| public int | Returns: the index at which the given method ref entry occurs in the constant pool or -1 if the value does not occur.the name of the interface which
contains the method being referenced. interfaceMethodClassName, String the name of the method being referenced. interfaceMethodName, String the type descriptor of the method being
referenced. interfaceMethodType)Get the index of a given CONSTANT_INTERFACEMETHODREF entry in the constant pool. |
| public int | Returns: the index at which the given method ref entry occurs in the constant pool or -1 if the value does not occur.the name of the class which contains the
method being referenced. methodClassName, String the name of the method being referenced. methodName, String the type descriptor of the method being referenced. methodType)Get the index of a given CONSTANT_METHODREF entry in the constant pool. |
| public int | Returns: the index at which the given NameAndType entry occurs in the constant pool or -1 if the value does not occur.the name name, String the type type)Get the index of a given CONSTANT_NAMEANDTYPE entry in the constant pool. |
| public int | Returns: the index at which the given string occurs in the constant pool or -1 if the value does not occur.the string value of the UTF8 entry. value)Get the index of a given UTF8 constant pool entry. |
| public void | read(DataInputStream
the DataInputStream of a class file. classStream)Read the constant pool from a class input stream. |
| public void | |
| public int | |
| public String | Returns: the constant pool entries as stringsOverrides java. |
| entries | back to summary |
|---|---|
| private final List<ConstantPoolEntry> entries The entries in the constant pool. | |
| utf8Indexes | back to summary |
|---|---|
| private final Map<String, Integer> utf8Indexes A Hashtable of UTF8 entries - used to get constant pool indexes of the UTF8 values quickly | |
| ConstantPool | back to summary |
|---|---|
| public ConstantPool() Initialise the constant pool. | |
| addEntry | back to summary |
|---|---|
| public int addEntry(ConstantPoolEntry entry) Add an entry to the constant pool.
| |
| getClassEntry | back to summary |
|---|---|
| public int getClassEntry(String className) Get the index of a given CONSTANT_CLASS entry in the constant pool.
| |
| getConstantEntry | back to summary |
|---|---|
| public int getConstantEntry(Object constantValue) Get the index of a given constant value entry in the constant pool.
| |
| getEntry | back to summary |
|---|---|
| public ConstantPoolEntry getEntry(int index) Get an constant pool entry at a particular index.
| |
| getFieldRefEntry | back to summary |
|---|---|
| public int getFieldRefEntry(String fieldClassName, String fieldName, String fieldType) Get the index of a given CONSTANT_FIELDREF entry in the constant pool.
| |
| getInterfaceMethodRefEntry | back to summary |
|---|---|
| public int getInterfaceMethodRefEntry(String interfaceMethodClassName, String interfaceMethodName, String interfaceMethodType) Get the index of a given CONSTANT_INTERFACEMETHODREF entry in the constant pool.
| |
| getMethodRefEntry | back to summary |
|---|---|
| public int getMethodRefEntry(String methodClassName, String methodName, String methodType) Get the index of a given CONSTANT_METHODREF entry in the constant pool.
| |
| getNameAndTypeEntry | back to summary |
|---|---|
| public int getNameAndTypeEntry(String name, String type) Get the index of a given CONSTANT_NAMEANDTYPE entry in the constant pool. | |
| getUTF8Entry | back to summary |
|---|---|
| public int getUTF8Entry(String value) Get the index of a given UTF8 constant pool entry.
| |
| read | back to summary |
|---|---|
| public void read(DataInputStream classStream) throws IOException Read the constant pool from a class input stream.
| |
| resolve | back to summary |
|---|---|
| public void resolve() Resolve the entries in the constant pool. Resolution of the constant pool involves transforming indexes to other constant pool entries into the actual data for that entry. | |
| size | back to summary |
|---|---|
| public int size() Get the size of the constant pool.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Dump the constant pool to a string. | |