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.


Variable Index

 o parent

Constructor Index

 o JcfConstantPool(JcfClassFile)
Instantiates with a default capacity of 256 and increment of 256.
 o JcfConstantPool(JcfClassFile, int)
Instantiates with a default increment of 256.
 o JcfConstantPool(JcfClassFile, int, int)
Creates an empty constant pool.
 o JcfConstantPool(JcfClassInput, JcfClassFile)
Instantiates the constant pool from a JcfClassInput, calling read() to perform the actual read from the JcfClassInput.

Method Index

 o addConstant(CptGeneric)
Adds a new constant to the end of the constant pool.
 o classNameAt(int)
 o constantAt(int)
Returns a specific constant in the constant pool, by index.
 o getClassFile()
 o insertConstantAt(CptGeneric, int)
Inserts a constant in the constant pool at a specific index.
 o memberClassNameAt(int)
 o memberNameAt(int)
 o memberSignatureAt(int)
 o read(JcfClassInput)
Reads the entire constant pool from a JcfClassInput, calling readConstant() to read individual constants.
 o readConstant(JcfClassInput, byte)
Factory method to read in and add a new CptGeneric object (or subclass) to the pool.
 o stringTextAt(int)
 o utfAt(int)
 o write(JcfClassOutput)
Writes out the constant pool to a JcfClassOutput
 o writeConstant(JcfClassOutput, CptGeneric, int)
Writes out a single tag and constant.

Variables

 o parent
 protected JcfClassFile parent

Constructors

 o 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
 o JcfConstantPool
 public JcfConstantPool(JcfClassFile p,
                        int initialCapacity,
                        int capacityIncrement)
Creates an empty constant pool.

Parameters:
p - The parent JcfClassFile that owns this constant pool
 o JcfConstantPool
 public JcfConstantPool(JcfClassFile p,
                        int initialCapacity)
Instantiates with a default increment of 256.

 o JcfConstantPool
 public JcfConstantPool(JcfClassFile p)
Instantiates with a default capacity of 256 and increment of 256.

Methods

 o getClassFile
 public final JcfClassFile getClassFile()
 o 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
 o 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
 o addConstant
 public void addConstant(CptGeneric constant)
Adds a new constant to the end of the constant pool.

Parameters:
constant - The constant to be added.
 o constantAt
 public CptGeneric constantAt(int index) throws ArrayIndexOutOfBoundsException
Returns a specific constant in the constant pool, by index.

 o insertConstantAt
 public void insertConstantAt(CptGeneric constant,
                              int index)
Inserts a constant in the constant pool at a specific index.

 o 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.
 o 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
 o utfAt
 public final String utfAt(int index)
Parameters:
index - the index of a CptUTF
Returns:
s actual string at that index
 o 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
 o 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
 o memberClassNameAt
 public final String memberClassNameAt(int index)
Parameters:
index - the index of a CptMember
Returns:
s the class name of the member
 o memberNameAt
 public final String memberNameAt(int index)
Parameters:
index - the index of a CptMember
Returns:
s the name of the member
 o 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