|
Jode 1.90-CVS Build Aug 6, 2004 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jode.bytecode.ConstantPool
net.sf.jode.bytecode.GrowableConstantPool
This class represent a constant pool, where new constants can be added to. Normally you wont need to touch this class, as ClassInfo already does all the hard work. You will only need it if you want to add your own custom attributes that use the constant pool.
Field Summary |
Fields inherited from class net.sf.jode.bytecode.ConstantPool |
CLASS, DOUBLE, FIELDREF, FLOAT, INTEGER, INTERFACEMETHODREF, LONG, METHODREF, NAMEANDTYPE, STRING, UTF8 |
Constructor Summary | |
GrowableConstantPool()
Create a new growable constant pool |
Method Summary | |
int |
putClassName(java.lang.String name)
Adds a new class name entry to the constant pool and returns the index. |
int |
putClassType(java.lang.String name)
Adds a new class entry to the constant pool and returns the index. |
int |
putConstant(java.lang.Object c)
Puts a "one slot" constant into this constant pool. |
int |
putLongConstant(java.lang.Object c)
Puts a "double slot" constant into this constant pool. |
int |
putRef(int tag,
Reference ref)
Adds a new field/method or interface reference to the constant pool and returns the index. |
int |
putUTF8(java.lang.String utf)
Adds a new UTF8 entry to the constant pool and returns the index. |
int |
reserveConstant(java.lang.Object c)
Reserves an entry in this constant pool for a constant (for ldc). |
void |
write(java.io.DataOutputStream stream)
Writes the constant pool to the stream. |
Methods inherited from class net.sf.jode.bytecode.ConstantPool |
getClassName, getClassType, getConstant, getRef, getTag, getUTF8, iterateClassNames, read, size, toString, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public GrowableConstantPool()
Method Detail |
public final int putUTF8(java.lang.String utf)
utf
- the UTF8 string.
java.lang.IllegalStateException
- if the pool was already written,
but the entry was not added before.public int putClassName(java.lang.String name)
name
- the dot separated full qualified class name.
java.lang.IllegalArgumentException
- if the class name is illegal.
java.lang.IllegalStateException
- if the pool was already written,
but the entry was not added before.public int putClassType(java.lang.String name)
name
- the type signature of the class to add.
java.lang.IllegalArgumentException
- if the class name is illegal.
java.lang.IllegalStateException
- if the pool was already written,
but the entry was not added before.public int putRef(int tag, Reference ref)
tag
- the tag of the reference, one of FIELDREF, METHODREF
or INTERFACEMETHODREF.ref
- the reference.
java.lang.IllegalArgumentException
- if the reference type or
class name is illegal.
java.lang.IllegalStateException
- if the pool was already written,
but the entry was not added before.public int putConstant(java.lang.Object c)
c
- the constant; must be of type
Integer, Float or String
java.lang.IllegalArgumentException
- if the constant is of wrong type.
java.lang.IllegalStateException
- if the pool was already written,
but the entry was not added before.public int putLongConstant(java.lang.Object c)
c
- the constant; must be of type Long or Double
java.lang.IllegalArgumentException
- if the constant is of wrong type.
java.lang.IllegalStateException
- if the pool was already written,
but the entry was not added before.public int reserveConstant(java.lang.Object c)
c
- the constant, must be of type
Integer, Float or String
public void write(java.io.DataOutputStream stream) throws java.io.IOException
ClassInfo.write(java.io.DataOutputStream)
.
stream
- the stream to write to.
java.io.IOException
- if it occured while writing.
|
Jode 1.90-CVS Build Aug 6, 2004 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |