All Packages Class Hierarchy This Package Previous Next Index
Class lti.java.jcf.JcfConstantPool
java.lang.Object
|
+----java.util.Vector
|
+----lti.java.jcf.JcfConstantPool
- public class JcfConstantPool
- extends Vector
- implements RuntimeConstants
JcfConstantPool is a dynamic, in-memory class file constant pool.
The pool can be read and written, and can be extended to support
new constant pool tags.
-
parent
-
-
JcfConstantPool(JcfClassFile)
- Instantiates with a default capacity of 256 and increment of 256.
-
JcfConstantPool(JcfClassFile, int)
- Instantiates with a default increment of 256.
-
JcfConstantPool(JcfClassFile, int, int)
- Creates an empty constant pool.
-
JcfConstantPool(JcfClassInput, JcfClassFile)
- Instantiates the constant pool from a JcfClassInput, calling read()
to perform the actual read from the JcfClassInput.
-
addConstant(CptGeneric)
- Adds a new constant to the end of the constant pool.
-
classNameAt(int)
-
-
constantAt(int)
- Returns a specific constant in the constant pool, by index.
-
getClassFile()
-
-
insertConstantAt(CptGeneric, int)
- Inserts a constant in the constant pool at a specific index.
-
memberClassNameAt(int)
-
-
memberNameAt(int)
-
-
memberSignatureAt(int)
-
-
read(JcfClassInput)
- Reads the entire constant pool from a JcfClassInput, calling readConstant()
to read individual constants.
-
readConstant(JcfClassInput, byte)
- Factory method to read in and add a new CptGeneric object (or subclass)
to the pool.
-
stringTextAt(int)
-
-
utfAt(int)
-
-
write(JcfClassOutput)
- Writes out the constant pool to a JcfClassOutput
-
writeConstant(JcfClassOutput, CptGeneric, int)
- Writes out a single tag and constant.
parent
protected JcfClassFile parent
JcfConstantPool
public JcfConstantPool(JcfClassInput ist,
JcfClassFile p) throws ClassFormatError, IOException
- Instantiates the constant pool from a JcfClassInput, calling read()
to perform the actual read from the JcfClassInput.
- Parameters:
- ist - The JcfClassInput to read the pool from
- p - The parent JcfClassFile that owns this constant pool
JcfConstantPool
public JcfConstantPool(JcfClassFile p,
int initialCapacity,
int capacityIncrement)
- Creates an empty constant pool.
- Parameters:
- p - The parent JcfClassFile that owns this constant pool
JcfConstantPool
public JcfConstantPool(JcfClassFile p,
int initialCapacity)
- Instantiates with a default increment of 256.
JcfConstantPool
public JcfConstantPool(JcfClassFile p)
- Instantiates with a default capacity of 256 and increment of 256.
getClassFile
public final JcfClassFile getClassFile()
readConstant
public int readConstant(JcfClassInput st,
byte tag) throws IOException, ClassFormatError
- Factory method to read in and add a new CptGeneric object (or subclass)
to the pool.
- Parameters:
- st - The JcfClassInput to read the constant from
- tag - the tag value of the constant to be read
- Returns:
- s The number of extra pool slots the constant takes up
read
public void read(JcfClassInput ist) throws ClassFormatError, IOException
- Reads the entire constant pool from a JcfClassInput, calling readConstant()
to read individual constants.
- Parameters:
- ist - The JcfClassInput to read the pool from
- p - The parent JcfClassFile that owns this constant pool
addConstant
public void addConstant(CptGeneric constant)
- Adds a new constant to the end of the constant pool.
- Parameters:
- constant - The constant to be added.
constantAt
public CptGeneric constantAt(int index) throws ArrayIndexOutOfBoundsException
- Returns a specific constant in the constant pool, by index.
insertConstantAt
public void insertConstantAt(CptGeneric constant,
int index)
- Inserts a constant in the constant pool at a specific index.
write
public void write(JcfClassOutput ost) throws IOException
- Writes out the constant pool to a JcfClassOutput
- Parameters:
- ost - The JcfClassOutput to write the pool to.
writeConstant
public void writeConstant(JcfClassOutput ost,
CptGeneric constant,
int index) throws IOException
- Writes out a single tag and constant. Override to implement tag
altering.
- Parameters:
- ost - The JcfClassOutput to write to
- constant - The CptGeneric constant object to be written
- index - The index of the specified constant in the pool
utfAt
public final String utfAt(int index)
- Parameters:
- index - the index of a CptUTF
- Returns:
- s actual string at that index
classNameAt
public final String classNameAt(int index)
- Parameters:
- index - the index of a CptClass
- Returns:
- s name of the class referred to by that CptClass
stringTextAt
public final String stringTextAt(int index)
- Parameters:
- index - the index of a CptString
- Returns:
- s the string of the CptUTF pointed to by the CptString
memberClassNameAt
public final String memberClassNameAt(int index)
- Parameters:
- index - the index of a CptMember
- Returns:
- s the class name of the member
memberNameAt
public final String memberNameAt(int index)
- Parameters:
- index - the index of a CptMember
- Returns:
- s the name of the member
memberSignatureAt
public final String memberSignatureAt(int index)
- Parameters:
- index - the index of a CptMember
- Returns:
- s the signature of the member
All Packages Class Hierarchy This Package Previous Next Index