public class ConstantPool
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
ConstantPool.ClassInfo
Represents a CONSTANT_Class_info in constant pool
|
class |
ConstantPool.DoubleInfo |
class |
ConstantPool.Entry
Base class for entries in ConstantPool.
|
class |
ConstantPool.FieldRefInfo
Represents a CONSTANT_FieldRef in constant pool
|
class |
ConstantPool.FloatInfo |
class |
ConstantPool.IntegerInfo |
class |
ConstantPool.InterfaceMethodRefInfo
Represents a CONSTANT_InterfaceMethodRef in constant pool
|
class |
ConstantPool.LongInfo |
class |
ConstantPool.MethodRefInfo
Represents a CONSTANT_MethodRef in constant pool
|
class |
ConstantPool.NameAndTypeInfo
Represents a CONSTANT_NameAndType in constant pool
|
class |
ConstantPool.NullEntry |
class |
ConstantPool.StringInfo |
class |
ConstantPool.Utf8Info |
Modifier and Type | Field and Description |
---|---|
static byte |
CONSTANT_Class
Constant, that represents a class_ref tag in constant pool
|
static byte |
CONSTANT_Double
Constant, that represents a double tag in constant pool
|
static byte |
CONSTANT_Fieldref
Constant, that represents a field_ref tag in constant pool
|
static byte |
CONSTANT_Float
Constant, that represents a float tag in constant pool
|
static byte |
CONSTANT_Integer
Constant, that represents a integer tag in constant pool
|
static byte |
CONSTANT_InterfaceMethodref
Constant, that represents a interfacemethod_ref tag in constant pool
|
static byte |
CONSTANT_Long
Constant, that represents a long tag in constant pool
|
static byte |
CONSTANT_Methodref
Constant, that represents a method_ref tag in constant pool
|
static byte |
CONSTANT_NameAndType
Constant, that represents a nameAndType tag in constant pool
|
static byte |
CONSTANT_String
Constant, that represents a string tag in constant pool
|
static byte |
CONSTANT_Utf8
Constant, that represents a Utf8 tag in constant pool
|
Constructor and Description |
---|
ConstantPool()
Creates an empty constant pool.
|
Modifier and Type | Method and Description |
---|---|
short |
add(ConstantPool.Entry entry)
Adds an entry to this constant pool.
|
ConstantPool.ClassInfo |
addClassInfo(java.lang.String className)
Adds a new ClassInfo.
|
ConstantPool.DoubleInfo |
addDoubleInfo(int highBytes,
int lowBytes)
Adds a new DoubleInfo.
|
ConstantPool.FieldRefInfo |
addFieldRefInfo(ConstantPool.ClassInfo ci,
java.lang.String name,
java.lang.String desc)
Adds a new FieldRefInfo.
|
ConstantPool.FloatInfo |
addFloatInfo(int bytes)
Adds a new FloatInfo.
|
ConstantPool.IntegerInfo |
addIntegerInfo(int bytes)
Adds a new IntegerInfo.
|
ConstantPool.InterfaceMethodRefInfo |
addInterfaceMethodRefInfo(ConstantPool.ClassInfo ci,
java.lang.String name,
java.lang.String desc)
Adds a new InterfaceMethodRefInfo.
|
ConstantPool.LongInfo |
addLongInfo(int highBytes,
int lowBytes)
Adds a new LongInfo.
|
ConstantPool.MethodRefInfo |
addMethodRefInfo(ConstantPool.ClassInfo ci,
java.lang.String name,
java.lang.String desc)
Adds a new MethodRefInfo.
|
ConstantPool.NameAndTypeInfo |
addNameAndTypeInfo(java.lang.String name,
java.lang.String descriptor)
Adds a new NameAndTypeInfo.
|
ConstantPool.StringInfo |
addStringInfo(java.lang.String s)
Adds a new StringInfo.
|
ConstantPool.Utf8Info |
addUtf8Info(java.lang.String s)
Adds a new Utf8Info.
|
ConstantPool.Entry |
get(int index)
Gets an entry from constant pool.
|
java.lang.String |
getClassName(short index)
Index must point to a Class_info structure in Constant pool
|
java.lang.String |
getStringValue(short index)
Gets a String at given constant pool index.
|
java.lang.String |
getUtf8(short index)
Gets a String at given constant pool index.
|
int |
size()
Get the size of this ConstantPool.
|
byte[] |
toBytes() |
java.lang.String |
toString() |
public static final byte CONSTANT_Class
public static final byte CONSTANT_Double
public static final byte CONSTANT_Fieldref
public static final byte CONSTANT_Float
public static final byte CONSTANT_Integer
public static final byte CONSTANT_InterfaceMethodref
public static final byte CONSTANT_Long
public static final byte CONSTANT_Methodref
public static final byte CONSTANT_NameAndType
public static final byte CONSTANT_String
public static final byte CONSTANT_Utf8
public short add(ConstantPool.Entry entry)
public ConstantPool.ClassInfo addClassInfo(java.lang.String className)
className
- a fully qualified class namepublic ConstantPool.DoubleInfo addDoubleInfo(int highBytes, int lowBytes)
highBytes
- double constantlowBytes
- double constantpublic ConstantPool.FieldRefInfo addFieldRefInfo(ConstantPool.ClassInfo ci, java.lang.String name, java.lang.String desc)
ci
- ClassInfo, that is supposed to contain created field
referencename
- Name of the fielddesc
- descriptor of the fieldpublic ConstantPool.FloatInfo addFloatInfo(int bytes)
bytes
- float constantpublic ConstantPool.IntegerInfo addIntegerInfo(int bytes)
bytes
- integer constantpublic ConstantPool.InterfaceMethodRefInfo addInterfaceMethodRefInfo(ConstantPool.ClassInfo ci, java.lang.String name, java.lang.String desc)
ci
- ClassInfo, that is supposed to contain created interface
method referencename
- Name of the methoddesc
- descriptor of the methodpublic ConstantPool.LongInfo addLongInfo(int highBytes, int lowBytes)
highBytes
- long constantlowBytes
- long constantpublic ConstantPool.MethodRefInfo addMethodRefInfo(ConstantPool.ClassInfo ci, java.lang.String name, java.lang.String desc)
ci
- ClassInfo, that is supposed to contain created method
referencename
- Name of the methoddesc
- descriptor of the methodpublic ConstantPool.NameAndTypeInfo addNameAndTypeInfo(java.lang.String name, java.lang.String descriptor)
name
- Name to adddescriptor
- descriptor to addpublic ConstantPool.StringInfo addStringInfo(java.lang.String s)
s
- String constant to addpublic ConstantPool.Utf8Info addUtf8Info(java.lang.String s)
s
- String to addpublic ConstantPool.Entry get(int index)
index
- index into constant poolpublic java.lang.String getClassName(short index)
index
- index to ClassInfo in constant pool.java.lang.IllegalArgumentException
- is throw, if entry at
given index does not point into ClassInfo, or
ClassInfo.getNameIndex() does not point to Utf8Infopublic java.lang.String getStringValue(short index)
index
- index into constant pooljava.lang.IllegalArgumentException
- is throw, if entry at
given index does not point into StringInfo or utf8Infopublic java.lang.String getUtf8(short index)
index
- index into constant pooljava.lang.IllegalArgumentException
- is throw, if entry at
given index does not point into Utf8Infopublic int size()
public byte[] toBytes()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2001. Documenation generated February 9 2016.