public class ConstantPool extends Object implements Cloneable, Node
Constant,
ConstantPoolGen| Constructor and Description |
|---|
ConstantPool(Constant[] constantPool) |
ConstantPool(DataInput input)
Reads constants from given input stream.
|
| Modifier and Type | Method and Description |
|---|---|
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)
Resolves constant to a string representation.
|
String |
constantToString(int index,
byte tag)
Retrieves 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)
Gets constant from constant pool.
|
Constant |
getConstant(int index,
byte tag)
Gets constant from constant pool and check whether it has the
expected type.
|
Constant[] |
getConstantPool() |
String |
getConstantString(int index,
byte tag)
Gets string from constant pool and bypass the indirection of
`ConstantClass' and `ConstantString' objects.
|
int |
getLength() |
void |
setConstant(int index,
Constant constant) |
void |
setConstantPool(Constant[] constantPool) |
String |
toString() |
public ConstantPool(Constant[] constantPool)
constantPool - Array of constantspublic ConstantPool(DataInput input) throws IOException, ClassFormatException
input - Input streamIOExceptionClassFormatExceptionpublic void accept(Visitor v)
public String constantToString(Constant c) throws ClassFormatException
c - Constant to be printedClassFormatExceptionpublic String constantToString(int index, byte tag) throws ClassFormatException
index - of constant in constant pooltag - expected typeClassFormatExceptionpublic void dump(DataOutputStream file) throws IOException
file - Output file streamIOExceptionpublic Constant getConstant(int index)
index - Index in constant poolConstantpublic Constant getConstant(int index, byte tag) throws ClassFormatException
index - Index in constant pooltag - Tag of expected constant, i.e., its typeClassFormatExceptionConstantpublic String getConstantString(int index, byte tag) throws ClassFormatException
index - Index in constant pooltag - Tag of expected constant, either ConstantClass or ConstantStringClassFormatExceptionConstantClass,
ConstantStringpublic int getLength()
public void setConstant(int index,
Constant constant)
constant - Constant to setpublic void setConstantPool(Constant[] constantPool)
constantPool - public String toString()
public ConstantPool copy()
Copyright © 2004–2020 The Apache Software Foundation. All rights reserved.