|
|||||||||
| Home >> All >> jreversepro >> [ reflect overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
jreversepro.reflect
Class JConstantPool

java.lang.Objectjreversepro.reflect.JConstantPool
- All Implemented Interfaces:
- jreversepro.common.KeyWords
- public class JConstantPool
- extends java.lang.Object
- implements jreversepro.common.KeyWords
- extends java.lang.Object
JConstantPool represents the abstraction of the ConstantPool.
| Field Summary | |
private JImport |
importedClasses
Reference to importedClasses that contains the list of imported classes. |
private java.util.List |
listEntries
listEntries contains the ConstantPool Entries. |
static int |
PTR_INVALID
PTR_INVALID of a pointer of a ConstantPool tag means that they are not applicable for that ConstantPool tag. |
static java.lang.String |
STR_INVALID
STR_INVALID corresponds to an invalid entry in the ConstantPool. |
static int |
TAG_CLASS
TAG_CLASS corresponds to CONSTANT_CLASS |
static int |
TAG_DOUBLE
TAG_DOUBLE corresponds to CONSTANT_DOUBLE |
static int |
TAG_FIELDREF
TAG_FIELDREF corresponds to CONSTANT_FIELDREF |
static int |
TAG_FLOAT
TAG_FLOAT corresponds to CONSTANT_FLOAT |
static int |
TAG_INTEGER
TAG_INTEGER corresponds to CONSTANT_INTEGER |
static int |
TAG_INTERFACEREF
TAG_INTERFACEREF corresponds to CONSTANT_INTERFACEREF |
static int |
TAG_LONG
TAG_LONG corresponds to CONSTANT_LONG |
static int |
TAG_METHODREF
TAG_METHODREF corresponds to CONSTANT_METHODREF |
static int |
TAG_NAMETYPE
TAG_NAMETYPE corresponds to CONSTANT_NAMETYPE |
static int |
TAG_NOTHING
TAG_NOTHING means that the ConstantPool Entry is invalid. |
static int |
TAG_STRING
TAG_STRING corresponds to CONSTANT_STRING |
static int |
TAG_UTF8
TAG_UTF8 corresponds to CONSTANT_UTF8 |
| Fields inherited from interface jreversepro.common.KeyWords |
ANY, BOOLEAN, BREAK, BYTE, CASE, CHAR, CLASS, CLASS_STRING, CLINIT, CLOSE_BRACKET, COND_AND, COND_NOT, COND_OR, CONTINUE, DEFAULT, DEFAULT_PACKAGE, DOUBLE, EQUALTO, FALSE, FLOAT, FOREIGN_CLASS, FOREIGN_OBJ, GOTO, INIT, INSTANCEOF, INT, INTERFACE, JVM_BOOLEAN, JVM_CHAR, JVM_VOID, LANG_OBJECT, LENGTH, LONG, NEW, NULL, OPEN_BRACKET, OPR_EQ, OPR_GE, OPR_GT, OPR_LE, OPR_LT, OPR_NE, OPR_NOT, REFERENCE, RET_ADDR, RETURN, SHORT, SPACE, STATIC, SUPER, SWITCH, THIS, THISCLASS, THROW, TRUE, VOID |
| Constructor Summary | |
JConstantPool(int cpMax)
Constructor. |
|
| Method Summary | |
void |
addClassEntry(int classIndex)
Adds a new TAG_CLASS entry to the constantpool. |
void |
addDoubleEntry(java.lang.String value)
Adds a new TAG_DOUBLE entry to the constantpool. |
void |
addFieldRefEntry(int ptr1,
int ptr2)
Adds a new TAG_FIELDREF entry to the constantpool. |
void |
addFloatEntry(java.lang.String value)
Adds a new TAG_FLOAT entry to the constantpool. |
void |
addIntegerEntry(java.lang.String value)
Adds a new TAG_INTEGER entry to the constantpool. |
void |
addInterfaceRefEntry(int ptr1,
int ptr2)
Adds a new TAG_INTERFACEREF entry to the constantpool. |
void |
addLongEntry(java.lang.String value)
Adds a new TAG_LONG entry to the constantpool. |
void |
addMethodRefEntry(int ptr1,
int ptr2)
Adds a new TAG_METHODREF entry to the constantpool. |
void |
addNameTypeEntry(int ptr1,
int ptr2)
Adds a new TAG_NAMETYPE entry to the constantpool. |
void |
addNullEntry()
Adds a NULL entry to the ConstantPool. |
void |
addStringEntry(int stringIndex)
Adds a new TAG_STRING entry to the constantpool. |
void |
addUtf8Entry(java.lang.String value)
Adds a new TAG_UTF8 entry to the constantpool. |
java.lang.String |
getBasicDataTypeValue(int index)
Returns the value for the ConstantPool Entries according to their types. |
java.lang.String |
getClassName(int index)
Given an index to TAG_CLASS this returns the class name pointed to by it. |
java.lang.String |
getCpValue(int index)
Returns the ConstantPool value. |
java.lang.String |
getDataType(int index)
Returns the data type of the given ConstantPool Index. |
java.util.List |
getEntries()
Returns the constantpool entries. |
java.lang.String |
getEntryInfo()
Returns the whole ConstantPool info in a formatter manner. |
java.lang.String |
getEntryInfo(int cpIndex)
Returns the name pointed to by this JConstantPoolEntry. |
java.lang.String |
getFieldName(int index)
Given an index to TAG_NAMETYPE this returns the name of the member ( field / method ) |
java.lang.String |
getFieldType(int index)
Given an index to TAG_NAMETYPE this returns the type of the member ( field / method ) |
java.lang.String |
getFirstDirectName(int index)
Returns the Utf8 value pointed by the first pointer of the index to the ConstantPool. |
JImport |
getImportedClasses()
The constantpool is the one and only source that contains the references to external types. |
java.lang.String |
getLdcString(int index)
Given an Cp index this returns the proper constant pool value depending on the tag type. |
int |
getMaxCpEntry()
Returns the number of ConstantPool Entries. |
java.lang.String |
getName(JConstantPoolEntry ent)
Returns the name pointed to by this JConstantPoolEntry. |
int |
getPtr1(int index)
Returns the first pointer of the ConstantPool Data. |
int |
getPtr2(int index)
Returns the second pointer of the ConstantPool Data. |
java.lang.String |
getSecondDirectName(int index)
Returns the Utf8 value pointed by the II pointer of the index to the ConstantPool. |
private void |
getSingleEntryInfo(java.lang.StringBuffer sb,
int cpIndex)
Describes the tag in brief. |
int |
getTagByte(int index)
Returns the tagbyte of the ConstantPool. |
java.lang.String |
getTagDescriptor(int index)
Describes the tag in brief. |
static java.lang.String |
getTagName(int tagByte)
Returns the actual name of the tag . |
java.lang.String |
getType(JConstantPoolEntry ent)
Returns the type pointed to by this JConstantPoolEntry. |
java.lang.String |
getUtf8String(int index)
Given an index to TAG_UTF8 this returns the string value. |
boolean |
isTagDouble(int index)
Returns if the given index to the ConstantPool is TAG_DOUBLE or not. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
STR_INVALID
public static final java.lang.String STR_INVALID
- STR_INVALID corresponds to an invalid entry in the
ConstantPool.
- See Also:
- Constant Field Values
PTR_INVALID
public static final int PTR_INVALID
- PTR_INVALID of a pointer of a ConstantPool tag means that
they are not applicable for that ConstantPool tag.
- See Also:
- Constant Field Values
TAG_NOTHING
public static final int TAG_NOTHING
- TAG_NOTHING means that the ConstantPool Entry is invalid.
- See Also:
- Constant Field Values
TAG_UTF8
public static final int TAG_UTF8
- TAG_UTF8 corresponds to CONSTANT_UTF8
- See Also:
- Constant Field Values
TAG_INTEGER
public static final int TAG_INTEGER
- TAG_INTEGER corresponds to CONSTANT_INTEGER
- See Also:
- Constant Field Values
TAG_FLOAT
public static final int TAG_FLOAT
- TAG_FLOAT corresponds to CONSTANT_FLOAT
- See Also:
- Constant Field Values
TAG_LONG
public static final int TAG_LONG
- TAG_LONG corresponds to CONSTANT_LONG
- See Also:
- Constant Field Values
TAG_DOUBLE
public static final int TAG_DOUBLE
- TAG_DOUBLE corresponds to CONSTANT_DOUBLE
- See Also:
- Constant Field Values
TAG_CLASS
public static final int TAG_CLASS
- TAG_CLASS corresponds to CONSTANT_CLASS
- See Also:
- Constant Field Values
TAG_STRING
public static final int TAG_STRING
- TAG_STRING corresponds to CONSTANT_STRING
- See Also:
- Constant Field Values
TAG_FIELDREF
public static final int TAG_FIELDREF
- TAG_FIELDREF corresponds to CONSTANT_FIELDREF
- See Also:
- Constant Field Values
TAG_METHODREF
public static final int TAG_METHODREF
- TAG_METHODREF corresponds to CONSTANT_METHODREF
- See Also:
- Constant Field Values
TAG_INTERFACEREF
public static final int TAG_INTERFACEREF
- TAG_INTERFACEREF corresponds to CONSTANT_INTERFACEREF
- See Also:
- Constant Field Values
TAG_NAMETYPE
public static final int TAG_NAMETYPE
- TAG_NAMETYPE corresponds to CONSTANT_NAMETYPE
- See Also:
- Constant Field Values
listEntries
private java.util.List listEntries
- listEntries contains the ConstantPool Entries.
The individual elements of the list are
JConstantPoolEntry.
importedClasses
private JImport importedClasses
- Reference to importedClasses that contains the list
of imported classes.
| Constructor Detail |
JConstantPool
public JConstantPool(int cpMax)
- Constructor.
| Method Detail |
getMaxCpEntry
public int getMaxCpEntry()
- Returns the number of ConstantPool Entries.
getEntries
public java.util.List getEntries()
- Returns the constantpool entries.
The individual elements are JConstantPoolEntry.
addFieldRefEntry
public void addFieldRefEntry(int ptr1,
int ptr2)
- Adds a new TAG_FIELDREF entry to the constantpool.
addMethodRefEntry
public void addMethodRefEntry(int ptr1,
int ptr2)
- Adds a new TAG_METHODREF entry to the constantpool.
addInterfaceRefEntry
public void addInterfaceRefEntry(int ptr1,
int ptr2)
- Adds a new TAG_INTERFACEREF entry to the constantpool.
addNameTypeEntry
public void addNameTypeEntry(int ptr1,
int ptr2)
- Adds a new TAG_NAMETYPE entry to the constantpool.
addNullEntry
public void addNullEntry()
- Adds a NULL entry to the ConstantPool.
Mainly useful when we add long/ double.
addUtf8Entry
public void addUtf8Entry(java.lang.String value)
- Adds a new TAG_UTF8 entry to the constantpool.
addIntegerEntry
public void addIntegerEntry(java.lang.String value)
- Adds a new TAG_INTEGER entry to the constantpool.
addFloatEntry
public void addFloatEntry(java.lang.String value)
- Adds a new TAG_FLOAT entry to the constantpool.
addDoubleEntry
public void addDoubleEntry(java.lang.String value)
- Adds a new TAG_DOUBLE entry to the constantpool.
addLongEntry
public void addLongEntry(java.lang.String value)
- Adds a new TAG_LONG entry to the constantpool.
addClassEntry
public void addClassEntry(int classIndex)
- Adds a new TAG_CLASS entry to the constantpool.
addStringEntry
public void addStringEntry(int stringIndex)
- Adds a new TAG_STRING entry to the constantpool.
getDataType
public java.lang.String getDataType(int index)
- Returns the data type of the given ConstantPool Index.
isTagDouble
public boolean isTagDouble(int index)
- Returns if the given index to the ConstantPool
is TAG_DOUBLE or not.
getPtr1
public int getPtr1(int index)
- Returns the first pointer of the ConstantPool Data.
getPtr2
public int getPtr2(int index)
- Returns the second pointer of the ConstantPool Data.
getTagByte
public int getTagByte(int index)
- Returns the tagbyte of the ConstantPool.
getCpValue
public java.lang.String getCpValue(int index)
- Returns the ConstantPool value.
getFirstDirectName
public java.lang.String getFirstDirectName(int index)
- Returns the Utf8 value pointed by the first pointer
of the index to the ConstantPool.
Say for example, if entry #6 has ptr1 to be #8
and the utf8 value of #8 is "MyString", this method
on given input 6 returns "MyString".
getSecondDirectName
public java.lang.String getSecondDirectName(int index)
- Returns the Utf8 value pointed by the II pointer
of the index to the ConstantPool.
Say for example, if entry #6 has ptr2 to be #8
and the utf8 value of #8 is "MyString", this method
on given input 6 returns "MyString".
getClassName
public java.lang.String getClassName(int index)
- Given an index to TAG_CLASS this returns the class
name pointed to by it. If the index is 0 then a
class of type ANY is returned.
getFieldName
public java.lang.String getFieldName(int index)
- Given an index to TAG_NAMETYPE this returns the
name of the member ( field / method )
getFieldType
public java.lang.String getFieldType(int index)
- Given an index to TAG_NAMETYPE this returns the
type of the member ( field / method )
getUtf8String
public java.lang.String getUtf8String(int index)
- Given an index to TAG_UTF8 this returns the
string value.
getLdcString
public java.lang.String getLdcString(int index) throws jreversepro.parser.ClassParserException
- Given an Cp index this returns the proper
constant pool value depending on the tag type.
If TAG_INTEGER, returned as such.
Else if TAG_STRING all the escape characters are
properly quoted and returned.
getImportedClasses
public JImport getImportedClasses()
- The constantpool is the one and only source that
contains the references to external types. Hence all
the entries are analyzed for all external types referred to by
this class and are consolidated into a class called JImport.
This JImport can further be used to get the short form of
classname etc.
getBasicDataTypeValue
public java.lang.String getBasicDataTypeValue(int index) throws jreversepro.parser.ClassParserException
- Returns the value for the ConstantPool Entries
according to their types.
getTagName
public static java.lang.String getTagName(int tagByte)
- Returns the actual name of the tag .
according to their types.
getTagDescriptor
public java.lang.String getTagDescriptor(int index) throws jreversepro.parser.ClassParserException
- Describes the tag in brief. If a tag is relative tag
like TAG_FIELDREF or TAG_METHODREF then it lists out the
related tag information too,
getName
public java.lang.String getName(JConstantPoolEntry ent)
- Returns the name pointed to by this JConstantPoolEntry.
Usually this tag happens to be one of
TAG_FIELDREF, TAG_METHODREF or TAG_INTERFACEREF.
getType
public java.lang.String getType(JConstantPoolEntry ent)
- Returns the type pointed to by this JConstantPoolEntry.
Usually this tag happens to be one of
TAG_FIELDREF, TAG_METHODREF or TAG_INTERFACEREF.
getEntryInfo
public java.lang.String getEntryInfo()
- Returns the whole ConstantPool info in a formatter manner.
getEntryInfo
public java.lang.String getEntryInfo(int cpIndex)
- Returns the name pointed to by this JConstantPoolEntry.
Usually this tag happens to be one of
TAG_FIELDREF, TAG_METHODREF or TAG_INTERFACEREF.
getSingleEntryInfo
private void getSingleEntryInfo(java.lang.StringBuffer sb, int cpIndex)
- Describes the tag in brief. If a tag is relative tag
like TAG_FIELDREF or TAG_METHODREF then it continues to
report the dependent tag information until it reaches a
tag which is not dependent on anything else.
Usually the final tag happens to a TAG_UTF8.
|
|||||||||
| Home >> All >> jreversepro >> [ reflect overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
jreversepro.reflect.JConstantPool