gnu.bytecode
Class ConstantPool

java.lang.Object
  extended by gnu.bytecode.ConstantPool

public class ConstantPool
extends java.lang.Object

Manages a pool of constants, as used in .class files and Java interpreters.


Field Summary
static byte CLASS
           
static byte DOUBLE
           
static byte FIELDREF
           
static byte FLOAT
           
static byte INTEGER
           
static byte INTERFACE_METHODREF
           
static byte LONG
           
static byte METHODREF
           
static byte NAME_AND_TYPE
           
static byte STRING
           
static byte UTF8
           
 
Constructor Summary
ConstantPool()
           
ConstantPool(java.io.DataInputStream dstr)
           
 
Method Summary
 CpoolClass addClass(CpoolUtf8 name)
           
 CpoolClass addClass(ObjectType otype)
           
 CpoolClass addClass(java.lang.String name)
           
 CpoolValue2 addDouble(double val)
           
 CpoolRef addFieldRef(Field field)
           
 CpoolValue1 addFloat(float val)
           
 CpoolValue1 addInt(int val)
           
 CpoolValue2 addLong(long val)
           
 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(java.lang.String string)
           
 CpoolUtf8 addUtf8(java.lang.String s)
           
 int getCount()
           
 CpoolEntry getPoolEntry(int index)
          Get the index'th entry in pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

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

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(java.io.DataInputStream dstr)
             throws java.io.IOException
Throws:
java.io.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


addUtf8

public CpoolUtf8 addUtf8(java.lang.String s)

addClass

public CpoolClass addClass(ObjectType otype)

addClass

public CpoolClass addClass(java.lang.String name)

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(java.lang.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)

addMethodRef

public CpoolRef addMethodRef(Method method)

addFieldRef

public CpoolRef addFieldRef(Field field)