public class ConstantPool
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
ConstantPool.Constant
Constant
Base class of all constant entries
|
(package private) class |
ConstantPool.CP_Double
CP_Double
Constant entries that contain double-precision float data.
|
(package private) class |
ConstantPool.CP_Float
CP_Float
Constant entries that contain Float data.
|
(package private) class |
ConstantPool.CP_Int
CP_Int
Constant entries that contain Integer data.
|
(package private) class |
ConstantPool.CP_Long
CP_Long
Constant entries that contain LongInteger data.
|
(package private) class |
ConstantPool.CP_Str
CP_Str
Constant entries that contain String data.
|
(package private) class |
ConstantPool.CPX
CPX
Constant entries that contain a single constant-pool index.
|
(package private) class |
ConstantPool.CPX2
CPX2
Constant entries that contain two constant-pool indices.
|
(package private) class |
ConstantPool.Indent |
static class |
ConstantPool.SUBTAG
SUBTAG
A Tag descriptor of form method-handle constants
|
static class |
ConstantPool.TAG
TAG
A Tag descriptor of constants in the constant pool
|
Modifier and Type | Field and Description |
---|---|
private ClassData |
cd
Reference to the class data
|
private ConstantPool.Indent |
indent |
java.util.ArrayList<ConstantPool.Constant> |
pool
The actual pool of Constants
|
private boolean |
printTAG |
private static java.util.Hashtable<java.lang.Byte,ConstantPool.SUBTAG> |
subtaghash |
private static java.util.Hashtable<java.lang.Byte,ConstantPool.TAG> |
taghash |
Constructor and Description |
---|
ConstantPool(ClassData cd) |
ConstantPool(ClassData cd,
int size) |
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
_getClassName(int nameIndex)
_getClassName
Helper for getting class name.
|
java.lang.String |
ConstantStrValue(int cpx)
ConstantStrValue
Safely gets the string value of any Constant at any CP index.
|
java.lang.String |
decodeClassDescriptor(int cpx)
decodeClassDescriptor
Pulls the class name out of a string (at the CP index).
|
java.lang.String |
getClassName(ConstantPool.CPX classConst)
getClassName
Safely gets a Java class name from a ConstantClass from a CPX constant pool object.
|
java.lang.String |
getClassName(ConstantPool.CPX2 classConst)
getClassName
Safely gets a Java class name from a ConstantClass from a CPX2 constant pool
object.
|
java.lang.String |
getClassName(int cpx)
getClassName
Safely gets a Java class name from a ConstantClass from the CP at a given index.
|
ConstantPool.Constant |
getConst(int cpx)
getConst
Public getter - Safely gets a Constant from the CP at a given index.
|
java.lang.String |
getModule(int cpx)
getModule
Public string val - Safely gets the string-rep of a ConstantModule from the CP at a
given index.
|
java.lang.String |
getName(int cpx)
getTypeName
Safely gets a Java name from a ConstantUTF8 from the CP at a given index.
|
java.lang.String |
getPackage(int cpx)
getPackage
Public string val - Safely gets the string-rep of a ConstantPackage from the CP at a
given index.
|
java.lang.String |
getPrintedTAG(ConstantPool.TAG tag) |
java.lang.String |
getShortClassName(int cpx,
java.lang.String pkgPrefix)
getShortClassName
shortens a class name (if the class is in the given package).
|
java.lang.String |
getShortClassName(java.lang.String className,
java.lang.String pkgPrefix)
getShortClassName
shortens a class name (if the class is in the given package).
|
java.lang.String |
getString(int cpx)
getString
Public string val - Safely gets the string-rep of a ConstantUTF8 from the CP at a
given index.
|
private boolean |
inbounds(int cpx)
inbounds
bounds-check a CP index.
|
void |
print(java.io.PrintWriter out)
prints the entire constant pool.
|
(package private) void |
PrintConstant(java.io.PrintWriter out,
int cpx)
prints the Constant value at a given CP index.
|
void |
printlnClassId(java.io.PrintWriter out,
int cpx)
prints a constant value, with the print format based on the print options.
|
void |
printlnClassId(java.io.PrintWriter out,
int cpx,
boolean addComma) |
(package private) void |
read(java.io.DataInputStream in)
read
decodes a ConstantPool and it's constants from a data stream.
|
void |
setPrintTAG(boolean value) |
java.lang.String |
StringTag(int cpx)
StringTag
Public string val - Safely gets the string-rep of a Constant from the CP at a given
index.
|
java.lang.String |
StringValue(int cpx)
StringValue
Safely gets the string value of any Constant at any CP index.
|
private java.lang.String |
subtagToString(int subtag)
subtagToString
Getter that safely gets the string descriptor of a subtag
|
private static final java.util.Hashtable<java.lang.Byte,ConstantPool.TAG> taghash
private static final java.util.Hashtable<java.lang.Byte,ConstantPool.SUBTAG> subtaghash
private boolean printTAG
private final ConstantPool.Indent indent
public java.util.ArrayList<ConstantPool.Constant> pool
private ClassData cd
public ConstantPool(ClassData cd)
public ConstantPool(ClassData cd, int size)
public void setPrintTAG(boolean value)
public java.lang.String getPrintedTAG(ConstantPool.TAG tag)
void read(java.io.DataInputStream in) throws java.io.IOException
java.io.IOException
private boolean inbounds(int cpx)
public ConstantPool.Constant getConst(int cpx)
public java.lang.String StringTag(int cpx)
public java.lang.String getString(int cpx)
public java.lang.String getModule(int cpx)
public java.lang.String getPackage(int cpx)
public java.lang.String getName(int cpx)
public java.lang.String getClassName(int cpx)
public java.lang.String getClassName(ConstantPool.CPX2 classConst)
public java.lang.String getClassName(ConstantPool.CPX classConst)
private java.lang.String _getClassName(int nameIndex)
public java.lang.String getShortClassName(java.lang.String className, java.lang.String pkgPrefix)
public java.lang.String getShortClassName(int cpx, java.lang.String pkgPrefix)
public java.lang.String decodeClassDescriptor(int cpx)
private java.lang.String subtagToString(int subtag)
public java.lang.String StringValue(int cpx)
public java.lang.String ConstantStrValue(int cpx)
public void print(java.io.PrintWriter out) throws java.io.IOException
java.io.IOException
void PrintConstant(java.io.PrintWriter out, int cpx)
public void printlnClassId(java.io.PrintWriter out, int cpx) throws java.io.IOException
java.io.IOException
public void printlnClassId(java.io.PrintWriter out, int cpx, boolean addComma) throws java.io.IOException
java.io.IOException