Package gnu.bytecode
Class ConstantPool
- java.lang.Object
-
- gnu.bytecode.ConstantPool
-
public class ConstantPool extends Object
Manages a pool of constants, as used in .class files and Java interpreters.
-
-
Field Summary
Fields Modifier and Type Field Description static byte
ANY_REF
Any one of the XXX_REF types.static byte
CLASS
static byte
DOUBLE
static byte
FIELDREF
static byte
FLOAT
static byte
INTEGER
static byte
INTERFACE_METHODREF
static byte
INVOKE_DYNAMIC
static byte
LONG
static byte
METHOD_HANDLE
static byte
METHOD_TYPE
static byte
METHODREF
static byte
NAME_AND_TYPE
static byte
STRING
static byte
UTF8
-
Constructor Summary
Constructors Constructor Description ConstantPool()
ConstantPool(DataInputStream dstr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CpoolClass
addClass(CpoolUtf8 name)
CpoolClass
addClass(ObjectType otype)
CpoolValue2
addDouble(double val)
CpoolRef
addFieldRef(Field field)
CpoolValue1
addFloat(float val)
CpoolValue1
addInt(int val)
CpoolValue2
addLong(long val)
CpoolMethodHandle
addMethodHandle(int kind, CpoolRef reference)
CpoolMethodHandle
addMethodHandle(Method method)
CpoolRef
addMethodRef(Method method)
CpoolNameAndType
addNameAndType(CpoolUtf8 name, CpoolUtf8 type)
CpoolNameAndType
addNameAndType(Field field)
CpoolNameAndType
addNameAndType(Method method)
CpoolRef
addRef(int tag, CpoolClass clas, CpoolNameAndType nameAndType)
CpoolString
addString(CpoolUtf8 str)
CpoolString
addString(String string)
CpoolUtf8
addUtf8(String s)
int
getCount()
CpoolEntry
getPoolEntry(int index)
Get the index'th entry in pool.
-
-
-
Field Detail
-
CLASS
public static final byte CLASS
- See Also:
- Constant Field Values
-
FIELDREF
public static final byte FIELDREF
- See Also:
- Constant Field Values
-
METHODREF
public static final byte METHODREF
- See Also:
- Constant Field Values
-
INTERFACE_METHODREF
public static final byte INTERFACE_METHODREF
- See Also:
- Constant Field Values
-
ANY_REF
public static final byte ANY_REF
Any one of the XXX_REF types.- See Also:
- Constant Field Values
-
STRING
public static final byte STRING
- See Also:
- Constant Field Values
-
INTEGER
public static final byte INTEGER
- See Also:
- Constant Field Values
-
FLOAT
public static final byte FLOAT
- See Also:
- Constant Field Values
-
LONG
public static final byte LONG
- See Also:
- Constant Field Values
-
DOUBLE
public static final byte DOUBLE
- See Also:
- Constant Field Values
-
METHOD_HANDLE
public static final byte METHOD_HANDLE
- See Also:
- Constant Field Values
-
METHOD_TYPE
public static final byte METHOD_TYPE
- See Also:
- Constant Field Values
-
INVOKE_DYNAMIC
public static final byte INVOKE_DYNAMIC
- See Also:
- Constant Field Values
-
NAME_AND_TYPE
public static final byte NAME_AND_TYPE
- See Also:
- Constant Field Values
-
UTF8
public static final byte UTF8
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ConstantPool
public ConstantPool()
-
ConstantPool
public ConstantPool(DataInputStream dstr) throws IOException
- Throws:
IOException
-
-
Method Detail
-
getCount
public final int getCount()
-
getPoolEntry
public final CpoolEntry getPoolEntry(int index)
Get the index'th entry in pool. Will throw ArrayIndexOutOfBoundsException on an invalid index
-
addClass
public CpoolClass addClass(ObjectType otype)
-
addMethodHandle
public CpoolMethodHandle addMethodHandle(Method method)
-
addMethodHandle
public CpoolMethodHandle addMethodHandle(int kind, CpoolRef reference)
-
addClass
public CpoolClass addClass(CpoolUtf8 name)
-
addInt
public CpoolValue1 addInt(int val)
-
addLong
public CpoolValue2 addLong(long val)
-
addFloat
public CpoolValue1 addFloat(float val)
-
addDouble
public CpoolValue2 addDouble(double val)
-
addString
public final CpoolString addString(String string)
-
addString
public CpoolString addString(CpoolUtf8 str)
-
addNameAndType
public CpoolNameAndType addNameAndType(Method method)
-
addNameAndType
public CpoolNameAndType addNameAndType(Field field)
-
addNameAndType
public CpoolNameAndType addNameAndType(CpoolUtf8 name, CpoolUtf8 type)
-
addRef
public CpoolRef addRef(int tag, CpoolClass clas, CpoolNameAndType nameAndType)
-
-