koala.dynamicjava.classfile
Class ConstantPool

java.lang.Object
  |
  +--koala.dynamicjava.classfile.ConstantPool

public class ConstantPool
extends java.lang.Object

This class represents JVM bytecode constant pools


Constructor Summary
ConstantPool()
          Creates a new constant pool
 
Method Summary
 short getCount()
          Returns the constant pool count according to the JVM Spec.
 short put(ClassIdentifier cst)
          Adds a constant to the pool.
 short put(ConstantString cst)
          Adds a constant to the pool.
 short put(java.lang.Double cst)
          Adds a constant to the pool.
 short put(FieldIdentifier cst)
          Adds a constant to the pool.
 short put(java.lang.Float cst)
          Adds a constant to the pool.
 short put(java.lang.Integer cst)
          Adds a constant to the pool.
 short put(InterfaceMethodIdentifier cst)
          Adds a constant to the pool.
 short put(java.lang.Long cst)
          Adds a constant to the pool.
 short put(MethodIdentifier cst)
          Adds a constant to the pool.
 void write(java.io.DataOutputStream out)
          Writes the content of this pool to the given output stream
 void write(java.io.OutputStream out)
          Writes the content of this pool to the given output stream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstantPool

public ConstantPool()
Creates a new constant pool
Method Detail

getCount

public short getCount()
Returns the constant pool count according to the JVM Spec.

put

public short put(java.lang.Integer cst)
Adds a constant to the pool. If the constant is already present in the pool, do nothing.
Parameters:
cst - the constant to add
Returns:
the index of the constant in the pool

put

public short put(java.lang.Long cst)
Adds a constant to the pool. If the constant is already present in the pool, do nothing.
Parameters:
cst - the constant to add
Returns:
the index of the constant in the pool

put

public short put(java.lang.Float cst)
Adds a constant to the pool. If the constant is already present in the pool, do nothing.
Parameters:
cst - the constant to add
Returns:
the index of the constant in the pool

put

public short put(java.lang.Double cst)
Adds a constant to the pool. If the constant is already present in the pool, do nothing.
Parameters:
cst - the constant to add
Returns:
the index of the constant in the pool

put

public short put(ConstantString cst)
Adds a constant to the pool. If the constant is already present in the pool, do nothing.
Parameters:
cst - the constant to add
Returns:
the index of the constant in the pool

put

public short put(ClassIdentifier cst)
Adds a constant to the pool. If the constant is already present in the pool, do nothing.
Parameters:
cst - the constant to add
Returns:
the index of the constant in the pool

put

public short put(FieldIdentifier cst)
Adds a constant to the pool. If the constant is already present in the pool, do nothing.
Parameters:
cst - the constant to add
Returns:
the index of the constant in the pool

put

public short put(MethodIdentifier cst)
Adds a constant to the pool. If the constant is already present in the pool, do nothing.
Parameters:
cst - the constant to add
Returns:
the index of the constant in the pool

put

public short put(InterfaceMethodIdentifier cst)
Adds a constant to the pool. If the constant is already present in the pool, do nothing.
Parameters:
cst - the constant to add
Returns:
the index of the constant in the pool

write

public void write(java.io.OutputStream out)
           throws java.io.IOException
Writes the content of this pool to the given output stream

write

public void write(java.io.DataOutputStream out)
           throws java.io.IOException
Writes the content of this pool to the given output stream


Copyright © 2001 Stephane Hillion. All Rights Reserved.