org.apache.bcel.classfile
public class ConstantPool extends Object implements Cloneable, Node, Serializable
See Also: Constant ConstantPoolGen
Constructor Summary | |
---|---|
ConstantPool(Constant[] constant_pool) |
Method Summary | |
---|---|
void | accept(Visitor v)
Called by objects that are traversing the nodes of the tree implicitely
defined by the contents of a Java class. |
String | constantToString(Constant c)
Resolve constant to a string representation.
|
String | constantToString(int index, byte tag)
Retrieve constant at `index' from constant pool and resolve it to
a string representation.
|
ConstantPool | copy() |
void | dump(DataOutputStream file)
Dump constant pool to file stream in binary format.
|
Constant | getConstant(int index)
Get constant from constant pool.
|
Constant | getConstant(int index, byte tag)
Get constant from constant pool and check whether it has the
expected type.
|
Constant[] | getConstantPool() |
String | getConstantString(int index, byte tag)
Get string from constant pool and bypass the indirection of
`ConstantClass' and `ConstantString' objects. |
int | getLength() |
void | setConstant(int index, Constant constant) |
void | setConstantPool(Constant[] constant_pool) |
String | toString() |
Parameters: constant_pool Array of constants
Parameters: v Visitor object
Parameters: c Constant to be printed
Returns: String representation
Parameters: index of constant in constant pool tag expected type
Returns: String representation
Returns: deep copy of this constant pool
Parameters: file Output file stream
Throws: IOException
Parameters: index Index in constant pool
Returns: Constant value
See Also: Constant
Parameters: index Index in constant pool tag Tag of expected constant, i.e., its type
Returns: Constant value
Throws: ClassFormatException
See Also: Constant
Returns: Array of constants.
See Also: Constant
Parameters: index Index in constant pool tag Tag of expected constant, either ConstantClass or ConstantString
Returns: Contents of string reference
Throws: ClassFormatException
See Also: ConstantClass ConstantString
Returns: Length of constant pool.
Parameters: constant Constant to set
Parameters: constant_pool
Returns: String representation.