Package jminusminus
Class CLConstantPool
java.lang.Object
jminusminus.CLConstantPool
Representation of a class' constant pool.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Adds the specified (non-null) item to the constant pool and returns its index.int
constantClassInfo
(String className) Returns the constant pool index of a singleton instance of CLConstantClassInfo.int
constantDoubleInfo
(double d) Returns the constant pool index of a singleton instance of CLConstantDoubleInfo.int
constantFieldRefInfo
(String className, String name, String type) Returns the constant pool index of a singleton instance of CLConstantFieldRefInfo.int
constantFloatInfo
(float f) Returns the constant pool index of a singleton instance of CLConstantFloatInfo.int
constantIntegerInfo
(int i) Returns the constant pool index of a singleton instance of CLConstantIntegerInfo.int
constantInterfaceMethodRefInfo
(String className, String name, String type) Returns the constant pool index of a singleton instance of CLConstantInterfaceMethodRefInfo.int
constantLongInfo
(long l) Returns the constant pool index of a singleton instance of CLConstantLongInfo.int
constantMethodRefInfo
(String className, String name, String type) Returns the constant pool index of a singleton instance of CLConstantMethodRefInfo.int
constantNameAndTypeInfo
(String name, String type) Returns the constant pool index of a singleton instance of CLConstantNameAndTypeInfo.int
Returns the constant pool index of a singleton instance of CLConstantStringInfo.int
Returns the constant pool index of a singleton instance of CLConstantUtf8Info.cpItem
(int i) Returns the constant pool item at the specified index or null.int
Returns the index of the specified item in the constant pool or -1.int
size()
Returns the size of the constant pool.void
write
(CLOutputStream out) Writes the contents of the constant pool to the specified output stream.
-
Constructor Details
-
CLConstantPool
public CLConstantPool()Constructs an empty constant pool.
-
-
Method Details
-
size
public int size()Returns the size of the constant pool.- Returns:
- the size of the constant pool.
-
find
Returns the index of the specified item in the constant pool or -1.- Parameters:
cpInfo
- item to find.- Returns:
- the index of the specified item in the constant pool or -1.
-
cpItem
Returns the constant pool item at the specified index or null.- Parameters:
i
- constant pool index.- Returns:
- the constant pool item at the specified index or null.
-
addCPItem
Adds the specified (non-null) item to the constant pool and returns its index.- Parameters:
cpInfo
- the item to add.- Returns:
- constant pool index of the item.
-
write
Writes the contents of the constant pool to the specified output stream.- Parameters:
out
- output stream.- Throws:
IOException
- if an error occurs while writing.
-
constantClassInfo
Returns the constant pool index of a singleton instance of CLConstantClassInfo.- Parameters:
className
- class or interface name in internal form.- Returns:
- constant pool index.
-
constantFieldRefInfo
Returns the constant pool index of a singleton instance of CLConstantFieldRefInfo.- Parameters:
className
- class or interface name in internal form.name
- name of the field.type
- descriptor of the field.- Returns:
- constant pool index.
-
constantMethodRefInfo
Returns the constant pool index of a singleton instance of CLConstantMethodRefInfo.- Parameters:
className
- class or interface name in internal form.name
- name of the method.type
- descriptor of the method.- Returns:
- constant pool index.
-
constantInterfaceMethodRefInfo
Returns the constant pool index of a singleton instance of CLConstantInterfaceMethodRefInfo.- Parameters:
className
- class or interface name in internal form.name
- name of the method.type
- descriptor of the method.- Returns:
- constant pool index.
-
constantStringInfo
Returns the constant pool index of a singleton instance of CLConstantStringInfo.- Parameters:
s
- the constant string value.- Returns:
- constant pool index.
-
constantIntegerInfo
public int constantIntegerInfo(int i) Returns the constant pool index of a singleton instance of CLConstantIntegerInfo.- Parameters:
i
- the constant int value.- Returns:
- constant pool index.
-
constantFloatInfo
public int constantFloatInfo(float f) Returns the constant pool index of a singleton instance of CLConstantFloatInfo.- Parameters:
f
- the constant floating-point value.- Returns:
- constant pool index.
-
constantLongInfo
public int constantLongInfo(long l) Returns the constant pool index of a singleton instance of CLConstantLongInfo.- Parameters:
l
- the constant long value.- Returns:
- constant pool index.
-
constantDoubleInfo
public int constantDoubleInfo(double d) Returns the constant pool index of a singleton instance of CLConstantDoubleInfo.- Parameters:
d
- the constant double value.- Returns:
- constant pool index.
-
constantNameAndTypeInfo
Returns the constant pool index of a singleton instance of CLConstantNameAndTypeInfo.- Parameters:
name
- field or method name.type
- field or method type descriptor.- Returns:
- constant pool index.
-
constantUtf8Info
Returns the constant pool index of a singleton instance of CLConstantUtf8Info.- Parameters:
s
- the constant string value.- Returns:
- constant pool index.
-