Class ConstantPoolParser
java.lang.Object
com.ibm.wala.shrike.shrikeCT.ConstantPoolParser
- All Implemented Interfaces:
ClassConstants
A ConstantPoolParser provides read-only access to the constant pool of a class file.
-
Nested Class Summary
-
Field Summary
Fields inherited from interface com.ibm.wala.shrike.shrikeCT.ClassConstants
ACC_ABSTRACT, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_TRANSIENT, ACC_VOLATILE, CONSTANT_Class, CONSTANT_Double, CONSTANT_FieldRef, CONSTANT_Float, CONSTANT_Integer, CONSTANT_InterfaceMethodRef, CONSTANT_InvokeDynamic, CONSTANT_Long, CONSTANT_MethodHandle, CONSTANT_MethodRef, CONSTANT_MethodType, CONSTANT_Module, CONSTANT_NameAndType, CONSTANT_Package, CONSTANT_String, CONSTANT_Utf8, MAGIC, REF_getField, REF_getStatic, REF_invokeInterface, REF_invokeSpecial, REF_invokeStatic, REF_invokeVirtual, REF_newInvokeSpecial, REF_putField, REF_putStatic
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetCPClass
(int i) double
getCPDouble
(int i) getCPDynBootstrap
(int i) getCPDynName
(int i) getCPDynType
(int i) float
getCPFloat
(int i) getCPHandleClass
(int i) byte
getCPHandleKind
(int i) getCPHandleName
(int i) getCPHandleType
(int i) int
getCPInt
(int i) long
getCPLong
(int i) getCPMethodType
(int i) getCPNATName
(int i) getCPNATType
(int i) getCPRefClass
(int i) getCPRefName
(int i) getCPRefType
(int i) getCPString
(int i) getCPUtf8
(int i) int
byte
getItemType
(int i) byte[]
int
int
static boolean
isRef
(byte b) Does b represent the tag of a constant pool reference to an (interface) method or field?
-
Constructor Details
-
ConstantPoolParser
- Parameters:
bytes
- the raw class file dataoffset
- the start of the constant pool dataitemCount
- the number of items in the pool- Throws:
InvalidClassFileException
-
-
Method Details
-
getRawBytes
public byte[] getRawBytes()- Returns:
- the buffer holding the raw class file data
-
getRawOffset
- Returns:
- the offset of the constant pool data in the raw class file buffer
- Throws:
IllegalStateException
-
getRawSize
- Returns:
- the size of the constant pool data in the raw class file buffer
- Throws:
IllegalStateException
-
getItemCount
public int getItemCount()- Returns:
- the number of constant pool items (maximum item index plus one)
-
getItemType
- Returns:
- the type of constant pool item i, or 0 if i is an unused constant pool item
- Throws:
IllegalArgumentException
-
getCPClass
- Returns:
- the name of the Class at constant pool item i, in JVM format (e.g., java/lang/Object)
- Throws:
InvalidClassFileException
IllegalArgumentException
-
getCPMethodType
- Returns:
- the name of the method at constant pool item i, in JVM format (e.g., java/lang/Object)
- Throws:
InvalidClassFileException
IllegalArgumentException
-
getCPString
- Returns:
- the String at constant pool item i
- Throws:
InvalidClassFileException
IllegalArgumentException
-
isRef
public static boolean isRef(byte b) Does b represent the tag of a constant pool reference to an (interface) method or field? -
getCPRefClass
- Returns:
- the name of the class part of the FieldRef, MethodRef, or InterfaceMethodRef at constant pool item i
- Throws:
InvalidClassFileException
IllegalArgumentException
-
getCPRefName
- Returns:
- the name part of the FieldRef, MethodRef, or InterfaceMethodRef at constant pool item i
- Throws:
InvalidClassFileException
IllegalArgumentException
-
getCPRefType
- Returns:
- the type part of the FieldRef, MethodRef, or InterfaceMethodRef at constant pool item i, in JVM format (e.g., I, Z, or Ljava/lang/Object;)
- Throws:
InvalidClassFileException
IllegalArgumentException
-
getCPNATName
- Returns:
- the name part of the NameAndType at constant pool item i
- Throws:
InvalidClassFileException
IllegalArgumentException
-
getCPNATType
- Returns:
- the type part of the NameAndType at constant pool item i, in JVM format (e.g., I, Z, or Ljava/lang/Object;)
- Throws:
InvalidClassFileException
IllegalArgumentException
-
getCPHandleName
- Returns:
- the name part of the MethodHandle at constant pool item i, in JVM format (e.g., I, Z, or Ljava/lang/Object;)
- Throws:
InvalidClassFileException
IllegalArgumentException
-
getCPHandleType
- Returns:
- the name part of the MethodHandle at constant pool item i, in JVM format (e.g., I, Z, or Ljava/lang/Object;)
- Throws:
InvalidClassFileException
IllegalArgumentException
-
getCPHandleClass
- Returns:
- the name part of the MethodHandle at constant pool item i, in JVM format (e.g., I, Z, or Ljava/lang/Object;)
- Throws:
InvalidClassFileException
IllegalArgumentException
-
getCPHandleKind
- Returns:
- the type of the MethodHandle at constant pool item i
- Throws:
InvalidClassFileException
IllegalArgumentException
-
getCPInt
- Returns:
- the value of the Integer at constant pool item i
- Throws:
IllegalArgumentException
-
getCPFloat
- Returns:
- the value of the Float at constant pool item i
- Throws:
IllegalArgumentException
-
getCPLong
- Returns:
- the value of the Long at constant pool item i
- Throws:
IllegalArgumentException
-
getCPDouble
- Returns:
- the value of the Double at constant pool item i
- Throws:
IllegalArgumentException
-
getCPDynBootstrap
public BootstrapMethodsReader.BootstrapMethod getCPDynBootstrap(int i) throws InvalidClassFileException, IllegalArgumentException - Returns:
- the BootstrapMethodTable index of the bootstrap method for this invokedynamic
- Throws:
InvalidClassFileException
IllegalArgumentException
-
getCPDynName
-
getCPDynType
-
getCPUtf8
- Returns:
- the value of the Utf8 string at constant pool item i
- Throws:
InvalidClassFileException
IllegalArgumentException
-