Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

ConstantPool Class Reference

Inheritance diagram for ConstantPool:
[legend]
Collaboration diagram for ConstantPool:
[legend]
List of all members.

Public Methods

 ConstantPool (Constant[] constant_pool)
void accept (Visitor v)
String constantToString (int index, byte tag) throws ClassFormatError
String constantToString (Constant c) throws ClassFormatError
ConstantPool copy ()
void dump (DataOutputStream file) throws IOException
Constant getConstant (int index)
Constant getConstant (int index, byte tag) throws ClassFormatError
Constant[] getConstantPool ()
String getConstantString (int index, byte tag) throws ClassFormatError
int getLength ()
void setConstant (int index, Constant constant)
void setConstantPool (Constant[] constant_pool)
String toString ()
 ConstantPool (Constant[] constant_pool)
void accept (Visitor v)
String constantToString (int index, byte tag) throws ClassFormatError
String constantToString (Constant c) throws ClassFormatError
ConstantPool copy ()
void dump (DataOutputStream file) throws IOException
Constant getConstant (int index)
Constant getConstant (int index, byte tag) throws ClassFormatError
Constant[] getConstantPool ()
String getConstantString (int index, byte tag) throws ClassFormatError
int getLength ()
void setConstant (int index, Constant constant)
void setConstantPool (Constant[] constant_pool)
String toString ()

Private Methods

 ConstantPool (DataInputStream file) throws IOException, ClassFormatError
 ConstantPool (DataInputStream file) throws IOException, ClassFormatError

Static Private Methods

final String escape (String str)
final String escape (String str)

Private Attributes

int constant_pool_count
Constant[] constant_pool
Constant[] constant_pool

Detailed Description

This class represents the constant pool, i.e. a table of constants. It may contain null references, due to the JVM specification that skips an entry after an 8-byte constant (double, long) entry.

Version:
Id:
ConstantPool.java,v 1.1.1.1 2002/01/24 03:44:01 pserver Exp
See also:
Constant
Author:
M. Dahm

Definition at line 15 of file lib/jpf/de/fub/bytecode/classfile/ConstantPool.java.


Constructor & Destructor Documentation

ConstantPool::ConstantPool Constant   constant_pool[] [inline]
 

Parameters:
constant_pool   Array of constants

Definition at line 22 of file lib/jpf/de/fub/bytecode/classfile/ConstantPool.java.

ConstantPool::ConstantPool DataInputStream   file [inline, private]
 

Read constants from given file stream.

Parameters:
file   Input stream
Exceptions:
IOException  
ClassFormatError  

Definition at line 33 of file lib/jpf/de/fub/bytecode/classfile/ConstantPool.java.

ConstantPool::ConstantPool Constant   constant_pool[] [inline]
 

Parameters:
constant_pool   Array of constants

Definition at line 22 of file src/de/fub/bytecode/classfile/ConstantPool.java.

ConstantPool::ConstantPool DataInputStream   file [inline, private]
 

Read constants from given file stream.

Parameters:
file   Input stream
Exceptions:
IOException  
ClassFormatError  

Definition at line 33 of file src/de/fub/bytecode/classfile/ConstantPool.java.


Member Function Documentation

void ConstantPool::accept Visitor   v [inline]
 

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.

Parameters:
v   Visitor object

Definition at line 65 of file src/de/fub/bytecode/classfile/ConstantPool.java.

void ConstantPool::accept Visitor   v [inline]
 

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.

Parameters:
v   Visitor object

Definition at line 65 of file lib/jpf/de/fub/bytecode/classfile/ConstantPool.java.

String ConstantPool::constantToString Constant   c [inline]
 

Resolve constant to a string representation.

Parameters:
constant   Constant to be printed
Returns:
String representation

Definition at line 88 of file src/de/fub/bytecode/classfile/ConstantPool.java.

String ConstantPool::constantToString int   index,
byte   tag
[inline]
 

Retrieve constant at `index' from constant pool and resolve it to a string representation.

Parameters:
index   of constant in constant pool
tag   expected type
Returns:
String representation

Definition at line 76 of file src/de/fub/bytecode/classfile/ConstantPool.java.

String ConstantPool::constantToString Constant   c [inline]
 

Resolve constant to a string representation.

Parameters:
constant   Constant to be printed
Returns:
String representation

Definition at line 88 of file lib/jpf/de/fub/bytecode/classfile/ConstantPool.java.

String ConstantPool::constantToString int   index,
byte   tag
[inline]
 

Retrieve constant at `index' from constant pool and resolve it to a string representation.

Parameters:
index   of constant in constant pool
tag   expected type
Returns:
String representation

Definition at line 76 of file lib/jpf/de/fub/bytecode/classfile/ConstantPool.java.

Referenced by CodeHTML::codeToHTML(), Utility::codeToString(), InvokeInstruction::toString(), FieldInstruction::toString(), and CPInstruction::toString().

ConstantPool ConstantPool::copy   [inline]
 

Returns:
deep copy of this constant pool

Definition at line 138 of file src/de/fub/bytecode/classfile/ConstantPool.java.

ConstantPool ConstantPool::copy   [inline]
 

Returns:
deep copy of this constant pool

Definition at line 137 of file lib/jpf/de/fub/bytecode/classfile/ConstantPool.java.

Referenced by JavaClass::copy().

void ConstantPool::dump DataOutputStream   file [inline]
 

Dump constant pool to file stream in binary format.

Parameters:
file   Output file stream
Exceptions:
IOException  

Definition at line 160 of file src/de/fub/bytecode/classfile/ConstantPool.java.

void ConstantPool::dump DataOutputStream   file [inline]
 

Dump constant pool to file stream in binary format.

Parameters:
file   Output file stream
Exceptions:
IOException  

Definition at line 159 of file lib/jpf/de/fub/bytecode/classfile/ConstantPool.java.

Referenced by JavaClass::dump().

Constant ConstantPool::getConstant int   index,
byte   tag
[inline]
 

Get constant from constant pool and check whether it has the expected type.

Parameters:
index   Index in constant pool
tag   Tag of expected constant, i.e., its type
Returns:
Constant value
See also:
Constant
Exceptions:
ClassFormatError  

Definition at line 206 of file src/de/fub/bytecode/classfile/ConstantPool.java.

Constant ConstantPool::getConstant int   index [inline]
 

Get constant from constant pool.

Parameters:
index   Index in constant pool
Returns:
Constant value
See also:
Constant

Definition at line 193 of file src/de/fub/bytecode/classfile/ConstantPool.java.

Constant ConstantPool::getConstant int   index,
byte   tag
[inline]
 

Get constant from constant pool and check whether it has the expected type.

Parameters:
index   Index in constant pool
tag   Tag of expected constant, i.e. its type
Returns:
Constant value
See also:
Constant
Exceptions:
ClassFormatError  

Definition at line 205 of file lib/jpf/de/fub/bytecode/classfile/ConstantPool.java.

Constant ConstantPool::getConstant int   index [inline]
 

Get constant from constant pool.

Parameters:
index   Index in constant pool
Returns:
Constant value
See also:
Constant

Definition at line 192 of file lib/jpf/de/fub/bytecode/classfile/ConstantPool.java.

Referenced by Unknown::Unknown(), CodeHTML::codeToHTML(), Utility::codeToString(), FieldOrMethod::getClassName(), LocalVariable::getName(), FieldOrMethod::getName(), PMGClass::getPMGClassName(), PMGClass::getPMGName(), Signature::getSignature(), LocalVariable::getSignature(), FieldOrMethod::getSignature(), SourceFile::getSourceFileName(), LDC2_W::getType(), LDC::getType(), ClassInfo::loadInterfaces(), Method::toString(), InvokeInstruction::toString(), InnerClass::toString(), CPInstruction::toString(), and ConstantValue::toString().

Constant [] ConstantPool::getConstantPool   [inline]
 

Returns:
Array of constants.
See also:
Constant

Definition at line 226 of file src/de/fub/bytecode/classfile/ConstantPool.java.

Constant [] ConstantPool::getConstantPool   [inline]
 

Returns:
Array of constants.
See also:
Constant

Definition at line 225 of file lib/jpf/de/fub/bytecode/classfile/ConstantPool.java.

Referenced by ConstantPoolGen::ConstantPoolGen().

String ConstantPool::getConstantString int   index,
byte   tag
[inline]
 

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.

Parameters:
index   Index in constant pool
tag   Tag of expected constant, either ConstantClass or ConstantString
Returns:
Contents of string reference
See also:
ConstantClass , ConstantString
Exceptions:
ClassFormatError  

Definition at line 240 of file src/de/fub/bytecode/classfile/ConstantPool.java.

String ConstantPool::getConstantString int   index,
byte   tag
[inline]
 

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.

Parameters:
index   Index in constant pool
tag   Tag of expected constant, either ConstantClass or ConstantString
Returns:
Contents of string reference
See also:
ConstantClass , ConstantString
Exceptions:
ClassFormatError  

Definition at line 239 of file lib/jpf/de/fub/bytecode/classfile/ConstantPool.java.

Referenced by JavaClass::JavaClass(), CodeHTML::codeToHTML(), FieldOrMethod::getClassName(), ExceptionTable::getExceptionNames(), CPInstruction::getType(), MethodInfo::loadExceptions(), Class2HTML::referenceClass(), InnerClass::toString(), ExceptionTable::toString(), and CodeException::toString().

int ConstantPool::getLength   [inline]
 

Returns:
Length of constant pool.

Definition at line 270 of file src/de/fub/bytecode/classfile/ConstantPool.java.

int ConstantPool::getLength   [inline]
 

Returns:
Length of constant pool.

Definition at line 270 of file lib/jpf/de/fub/bytecode/classfile/ConstantPool.java.

Referenced by JavaClass::toString().

void ConstantPool::setConstant int   index,
Constant   constant
[inline]
 

Parameters:
constant   Constant to set

Definition at line 277 of file src/de/fub/bytecode/classfile/ConstantPool.java.

void ConstantPool::setConstant int   index,
Constant   constant
[inline]
 

Parameters:
constant   Constant to set

Definition at line 277 of file lib/jpf/de/fub/bytecode/classfile/ConstantPool.java.

void ConstantPool::setConstantPool Constant   constant_pool[] [inline]
 

Parameters:
constant_pool  

Definition at line 283 of file src/de/fub/bytecode/classfile/ConstantPool.java.

void ConstantPool::setConstantPool Constant   constant_pool[] [inline]
 

Parameters:
constant_pool  

Definition at line 283 of file lib/jpf/de/fub/bytecode/classfile/ConstantPool.java.

String ConstantPool::toString   [inline]
 

Returns:
String representation.

Definition at line 290 of file src/de/fub/bytecode/classfile/ConstantPool.java.

String ConstantPool::toString   [inline]
 

Returns:
String representation.

Definition at line 290 of file lib/jpf/de/fub/bytecode/classfile/ConstantPool.java.


The documentation for this class was generated from the following files:
Generated at Thu Feb 7 07:07:29 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001