public class ConstantPool extends Object
| Constructor and Description |
|---|
ConstantPool() |
| Modifier and Type | Method and Description |
|---|---|
void |
addConstant(Constant constant)
Adds a new Constant to the end of the ConstantPool.
|
int |
addUTF8(String constant)
Searches the constant pool for the UTF8Constant that matches
constant. |
Constant |
getConstant(int index)
Returns the constant at the specified
index. |
Constant |
getConstantAt(int index)
Retrieve the Constant at the specified
index . |
int |
getNumEntries() |
int |
getSize()
Returns the number of constants in the pool.
|
public int addUTF8(String constant)
constant.
If constant can be found, it returns the constant pool index for the UTF8Constant.
If constant can't be found, it creates a new UTF8Constant, adds it to the pool,
and returns the index for that new UTF8Constant.constant - the UTF8 constant namepublic void addConstant(Constant constant)
constant - the constantpublic Constant getConstantAt(int index)
index .index - The index of the Constant. This value must be greater
than 0. Some double-sized Constants take up two indices. index are null if index is 0,
points to the middle of a Constant, or is beyond the size of the ConstantPool.public Constant getConstant(int index)
index.index - the index to look uppublic int getSize()
public int getNumEntries()
Copyright © 2012. All Rights Reserved.