|
|||||||||
| Home >> All >> org >> apache >> bcel >> [ classfile overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.bcel.classfile
Class ConstantPool

java.lang.Objectorg.apache.bcel.classfile.ConstantPool
- All Implemented Interfaces:
- java.lang.Cloneable, Node, java.io.Serializable
- public class ConstantPool
- extends java.lang.Object
- implements java.lang.Cloneable, Node, java.io.Serializable
- extends java.lang.Object
This class represents the constant pool, i.e., a table of constants, of a parsed classfile. It may contain null references, due to the JVM specification that skips an entry after an 8-byte constant (double, long) entry. Those interested in generating constant pools programatically should see ConstantPoolGen.
- Version:
- $Id: ConstantPool.java 386056 2006-03-15 11:31:56Z tcurdt $
| Field Summary | |
private Constant[] |
constant_pool
|
private int |
constant_pool_count
|
| Constructor Summary | |
|
ConstantPool(Constant[] constant_pool)
|
(package private) |
ConstantPool(java.io.DataInputStream file)
Read constants from given file stream. |
| Method Summary | |
void |
accept(Visitor v)
Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. |
java.lang.String |
constantToString(Constant c)
Resolve constant to a string representation. |
java.lang.String |
constantToString(int index,
byte tag)
Retrieve constant at `index' from constant pool and resolve it to a string representation. |
ConstantPool |
copy()
|
void |
dump(java.io.DataOutputStream file)
Dump constant pool to file stream in binary format. |
private static java.lang.String |
escape(java.lang.String str)
|
Constant |
getConstant(int index)
Get constant from constant pool. |
Constant |
getConstant(int index,
byte tag)
Get constant from constant pool and check whether it has the expected type. |
Constant[] |
getConstantPool()
|
java.lang.String |
getConstantString(int index,
byte tag)
Get string from constant pool and bypass the indirection of `ConstantClass' and `ConstantString' objects. |
int |
getLength()
|
void |
setConstant(int index,
Constant constant)
|
void |
setConstantPool(Constant[] constant_pool)
|
java.lang.String |
toString()
Convert this Object to a human-readable String. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
constant_pool_count
private int constant_pool_count
constant_pool
private Constant[] constant_pool
| Constructor Detail |
ConstantPool
public ConstantPool(Constant[] constant_pool)
ConstantPool
ConstantPool(java.io.DataInputStream file) throws java.io.IOException, ClassFormatException
- Read constants from given file stream.
| Method Detail |
accept
public void accept(Visitor v)
- Called by objects that are traversing the nodes of the tree implicitely
defined by the contents of a Java class. I.e., the hierarchy of methods,
fields, attributes, etc. spawns a tree of objects.
constantToString
public java.lang.String constantToString(Constant c) throws ClassFormatException
- Resolve constant to a string representation.
escape
private static final java.lang.String escape(java.lang.String str)
constantToString
public java.lang.String constantToString(int index, byte tag) throws ClassFormatException
- Retrieve constant at `index' from constant pool and resolve it to
a string representation.
dump
public void dump(java.io.DataOutputStream file) throws java.io.IOException
- Dump constant pool to file stream in binary format.
getConstant
public Constant getConstant(int index)
- Get constant from constant pool.
getConstant
public Constant getConstant(int index, byte tag) throws ClassFormatException
- Get constant from constant pool and check whether it has the
expected type.
getConstantPool
public Constant[] getConstantPool()
getConstantString
public java.lang.String getConstantString(int index, byte tag) throws ClassFormatException
- Get string from constant pool and bypass the indirection of
`ConstantClass' and `ConstantString' objects. I.e. these classes have
an index field that points to another entry of the constant pool of
type `ConstantUtf8' which contains the real data.
getLength
public int getLength()
setConstant
public void setConstant(int index,
Constant constant)
setConstantPool
public void setConstantPool(Constant[] constant_pool)
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object - Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null, string concatenation will instead use"null".The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode()).
copy
public ConstantPool copy()
|
|||||||||
| Home >> All >> org >> apache >> bcel >> [ classfile overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.bcel.classfile.ConstantPool