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 entriesstatic 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 TypeFieldDescriptionThe actual pool of Constants -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConstantStrValue
(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
(org.openjdk.asmtools.jdis.ConstantPool.CPX classConst) getClassName Safely gets a Java class name from a ConstantClass from a CPX constant pool object.getClassName
(org.openjdk.asmtools.jdis.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). works with a CP index to a ConstantClass.getShortClassName
(String className, String pkgPrefix) getShortClassName shortens a class name (if the class is in the given package). works with a string-encoded classname.getString
(int cpx) getString Public string val - Safely gets the string-rep of a ConstantUTF8 from the CP at a given index.void
print
(PrintWriter out) prints the entire constant pool.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) 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.
-
Field Details
-
pool
The actual pool of Constants
-
-
Constructor Details
-
ConstantPool
-
ConstantPool
-
-
Method Details
-
setPrintTAG
public void setPrintTAG(boolean value) -
getPrintedTAG
-
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. -
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 ";") -
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
-
printlnClassId
prints a constant value, with the print format based on the print options.- Throws:
IOException
-
printlnClassId
- Throws:
IOException
-