Package org.openjdk.asmtools.jdis
Class ConstantPool
java.lang.Object
org.openjdk.asmtools.jdis.ConstantPool
ConstantPool
Class representing the ConstantPool
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Constant Base class of all constant entries(package private) class
CP_Double Constant entries that contain double-precision float data.(package private) class
CP_Float Constant entries that contain Float data.(package private) class
CP_Int Constant entries that contain Integer data.(package private) class
CP_Long Constant entries that contain LongInteger data.(package private) class
CP_Str Constant entries that contain String data.(package private) class
CPX Constant entries that contain a single constant-pool index.(package private) class
CPX2 Constant entries that contain two constant-pool indices.(package private) class
static enum
SUBTAG A Tag descriptor of form method-handle constantsstatic enum
TAG A Tag descriptor of constants in the constant pool -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ClassData
Reference to the class dataprivate final ConstantPool.Indent
The actual pool of Constantsprivate boolean
private static final Hashtable<Byte,
ConstantPool.SUBTAG> private static final Hashtable<Byte,
ConstantPool.TAG> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate String
_getClassName
(int nameIndex) _getClassName Helper for getting class name.ConstantStrValue
(int cpx) ConstantStrValue Safely gets the string value of any Constant at any CP index.decodeClassDescriptor
(int cpx) decodeClassDescriptor Pulls the class name out of a string (at the CP index).getClassName
(int cpx) getClassName Safely gets a Java class name from a ConstantClass from the CP at a given index.getClassName
(ConstantPool.CPX classConst) getClassName Safely gets a Java class name from a ConstantClass from a CPX constant pool object.getClassName
(ConstantPool.CPX2 classConst) getClassName Safely gets a Java class name from a ConstantClass from a CPX2 constant pool object.getConst
(int cpx) getConst Public getter - Safely gets a Constant from the CP at a given index.getModule
(int cpx) getModule Public string val - Safely gets the string-rep of a ConstantModule from the CP at a given index.getName
(int cpx) getTypeName Safely gets a Java name from a ConstantUTF8 from the CP at a given index.getPackage
(int cpx) getPackage Public string val - Safely gets the string-rep of a ConstantPackage from the CP at a given index.getShortClassName
(int cpx, String pkgPrefix) getShortClassName shortens a class name (if the class is in the given package).getShortClassName
(String className, String pkgPrefix) getShortClassName shortens a class name (if the class is in the given package).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
(PrintWriter out) prints the entire constant pool.(package private) void
PrintConstant
(PrintWriter out, int cpx) prints the Constant value at a given CP index.void
printlnClassId
(PrintWriter out, int cpx) prints a constant value, with the print format based on the print options.void
printlnClassId
(PrintWriter out, int cpx, boolean addComma) (package private) void
read
(DataInputStream in) read decodes a ConstantPool and it's constants from a data stream.void
setPrintTAG
(boolean value) StringTag
(int cpx) StringTag Public string val - Safely gets the string-rep of a Constant from the CP at a given index.StringValue
(int cpx) StringValue Safely gets the string value of any Constant at any CP index.private String
subtagToString
(int subtag) subtagToString Getter that safely gets the string descriptor of a subtag
-
Field Details
-
taghash
-
subtaghash
-
printTAG
private boolean printTAG -
indent
-
pool
The actual pool of Constants -
cd
Reference to the class data
-
-
Constructor Details
-
ConstantPool
-
ConstantPool
-
-
Method Details
-
setPrintTAG
public void setPrintTAG(boolean value) -
getPrintedTAG
-
read
read decodes a ConstantPool and it's constants from a data stream.- Throws:
IOException
-
inbounds
private boolean inbounds(int cpx) inbounds bounds-check a CP index. -
getConst
getConst Public getter - Safely gets a Constant from the CP at a given index. -
StringTag
StringTag Public string val - Safely gets the string-rep of a Constant from the CP at a given index. -
getString
getString Public string val - Safely gets the string-rep of a ConstantUTF8 from the CP at a given index. Returns either null (if invalid), or the string value of the UTF8 -
getModule
getModule Public string val - Safely gets the string-rep of a ConstantModule from the CP at a given index. Returns either null (if invalid), or the string value of the ConstantModule -
getPackage
getPackage Public string val - Safely gets the string-rep of a ConstantPackage from the CP at a given index. Returns either null (if invalid), or the string value of the ConstantPackage -
getName
getTypeName Safely gets a Java name from a ConstantUTF8 from the CP at a given index. Returns either null (if invalid), or the Java name value of the UTF8 -
getClassName
getClassName Safely gets a Java class name from a ConstantClass from the CP at a given index. Returns either the Java class name, or a CP index reference string. -
getClassName
getClassName Safely gets a Java class name from a ConstantClass from a CPX2 constant pool object. (eg. Method/Field/Interface Ref) Returns either the Java class name, or a CP index reference string. -
getClassName
getClassName Safely gets a Java class name from a ConstantClass from a CPX constant pool object. (eg. Class Ref) Returns either the Java class name, or a CP index reference string. -
_getClassName
_getClassName Helper for getting class name. Checks bounds, does name conversion. -
getShortClassName
getShortClassName shortens a class name (if the class is in the given package). works with a string-encoded classname. -
getShortClassName
getShortClassName shortens a class name (if the class is in the given package). works with a CP index to a ConstantClass. -
decodeClassDescriptor
decodeClassDescriptor Pulls the class name out of a string (at the CP index). (drops any array descriptors, and the class descriptors ("L" and ";") -
subtagToString
subtagToString Getter that safely gets the string descriptor of a subtag -
StringValue
StringValue Safely gets the string value of any Constant at any CP index. -
ConstantStrValue
ConstantStrValue Safely gets the string value of any Constant at any CP index. This string is either a Constant's String value, or a CP index reference string. The Constant string has a tag descriptor in the beginning. -
print
prints the entire constant pool.- Throws:
IOException
-
PrintConstant
prints the Constant value at a given CP index. -
printlnClassId
prints a constant value, with the print format based on the print options.- Throws:
IOException
-
printlnClassId
- Throws:
IOException
-