public class ConstantPool extends Object implements Iterable<ConstantPool.Entry>
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.InvokeDynamicInfo |
class |
ConstantPool.LongInfo |
class |
ConstantPool.MethodHandleInfo |
class |
ConstantPool.MethodRefInfo
Represents a CONSTANT_MethodRef in constant pool.
|
class |
ConstantPool.MethodTypeInfo |
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_InvokeDynamic
Constant, that represents a invokeDynamic tag in constant pool
|
static byte |
CONSTANT_Long
Constant, that represents a long tag in constant pool
|
static byte |
CONSTANT_MethodHandle
Constant, that represents a methodHandle tag in constant pool
|
static byte |
CONSTANT_Methodref
Constant, that represents a method_ref tag in constant pool
|
static byte |
CONSTANT_MethodType
Constant, that represents a methodType 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(String className)
Adds a new ClassInfo.
|
ConstantPool.DoubleInfo |
addDoubleInfo(int highBytes,
int lowBytes)
Adds a new DoubleInfo.
|
ConstantPool.DoubleInfo |
addDoubleInfo(long bits)
Adds a new DoubleInfo.
|
ConstantPool.FieldRefInfo |
addFieldRefInfo(ConstantPool.ClassInfo ci,
String name,
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,
String name,
String desc)
Adds a new InterfaceMethodRefInfo.
|
ConstantPool.LongInfo |
addLongInfo(int highBytes,
int lowBytes)
Adds a new LongInfo.
|
ConstantPool.LongInfo |
addLongInfo(long l)
Adds a new LongInfo.
|
ConstantPool.MethodRefInfo |
addMethodRefInfo(ConstantPool.ClassInfo ci,
String name,
String desc)
Adds a new MethodRefInfo.
|
ConstantPool.NameAndTypeInfo |
addNameAndTypeInfo(String name,
String descriptor)
Adds a new NameAndTypeInfo.
|
ConstantPool.StringInfo |
addStringInfo(String s)
Adds a new StringInfo.
|
ConstantPool.Utf8Info |
addUtf8Info(String s)
Adds a new Utf8Info.
|
ConstantPool.Entry |
get(int index)
Gets an entry from constant pool.
|
String |
getClassName(short index)
Index must point to a Class_info structure in Constant pool
|
String |
getStringValue(short index)
Gets a String at given constant pool index. index must point to a
StringInfo or Utf8Info.
|
String |
getUtf8(short index)
Gets a String at given constant pool index. index must point to a
Utf8Info.
|
Iterator<ConstantPool.Entry> |
iterator() |
int |
size()
Get the size of this ConstantPool.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public static final byte CONSTANT_Utf8
public static final byte CONSTANT_Integer
public static final byte CONSTANT_Float
public static final byte CONSTANT_Long
public static final byte CONSTANT_Double
public static final byte CONSTANT_Class
public static final byte CONSTANT_String
public static final byte CONSTANT_Fieldref
public static final byte CONSTANT_Methodref
public static final byte CONSTANT_InterfaceMethodref
public static final byte CONSTANT_NameAndType
public static final byte CONSTANT_MethodHandle
public static final byte CONSTANT_MethodType
public static final byte CONSTANT_InvokeDynamic
public short add(ConstantPool.Entry entry)
entry
- Entrypublic ConstantPool.ClassInfo addClassInfo(String className)
className
- a fully qualified class namepublic ConstantPool.FieldRefInfo addFieldRefInfo(ConstantPool.ClassInfo ci, String name, String desc)
ci
- ClassInfo, that is supposed to contain created field referencename
- Name of the fielddesc
- descriptor of the fieldpublic ConstantPool.MethodRefInfo addMethodRefInfo(ConstantPool.ClassInfo ci, String name, String desc)
ci
- ClassInfo, that is supposed to contain created method
referencename
- Name of the methoddesc
- descriptor of the methodpublic ConstantPool.InterfaceMethodRefInfo addInterfaceMethodRefInfo(ConstantPool.ClassInfo ci, String name, String desc)
ci
- ClassInfo, that is supposed to contain created interface
method referencename
- Name of the methoddesc
- descriptor of the methodpublic ConstantPool.StringInfo addStringInfo(String s)
s
- String constant to addpublic ConstantPool.IntegerInfo addIntegerInfo(int bytes)
bytes
- integer constantpublic ConstantPool.FloatInfo addFloatInfo(int bytes)
bytes
- float constantpublic ConstantPool.LongInfo addLongInfo(int highBytes, int lowBytes)
highBytes
- long constantlowBytes
- long constantpublic ConstantPool.LongInfo addLongInfo(long l)
l
- long constantpublic ConstantPool.DoubleInfo addDoubleInfo(int highBytes, int lowBytes)
highBytes
- double constantlowBytes
- double constantpublic ConstantPool.DoubleInfo addDoubleInfo(long bits)
bits
- double constantpublic ConstantPool.NameAndTypeInfo addNameAndTypeInfo(String name, String descriptor)
name
- Name to adddescriptor
- descriptor to addpublic ConstantPool.Utf8Info addUtf8Info(String s)
s
- String to addpublic ConstantPool.Entry get(int index)
index
- index into constant poolpublic String getUtf8(short index)
index
- index into constant poolIllegalArgumentException
- is throw, if entry at given index does not point into
Utf8Infopublic String getStringValue(short index)
index
- index into constant poolIllegalArgumentException
- is throw, if entry at given index does not point into
StringInfo or utf8Infopublic String getClassName(short index)
index
- index to ClassInfo in constant pool.IllegalArgumentException
- is throw, if entry at given index does not point into
ClassInfo, or ClassInfo.getNameIndex() does not point to
Utf8Infopublic int size()
public Iterator<ConstantPool.Entry> iterator()
iterator
in interface Iterable<ConstantPool.Entry>
Copyright © 2017. All rights reserved.