|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjef.dna.constantPoolTable.impl.CPTable
public class CPTable
Default implementation for the ConstantPoolTable interface
| Field Summary | |
|---|---|
protected static Logger |
logger
|
| Constructor Summary | |
|---|---|
CPTable()
Creates a new instance of CPTable |
|
| Method Summary | |
|---|---|
void |
addAll(ConstantPoolTable cpt)
Appends the given ConstantPoolTable to the current one. |
void |
addElement(ConstantInfo entry)
Adds the specified ConstantInfo at the end of the constant pool table. |
void |
addElementAt(ConstantInfo entry,
int index,
boolean overwrite)
Adds the specified ConstantInfo at the provided position, shifting of one
index any subsequente entry (if exists) iff the overwrite parameter is set to
false, otherwise the current entry at index index will be
overwritten. |
java.lang.Object |
clone()
Clone the current ConstantPoolTable instance. |
void |
fromStream(java.io.DataInputStream dis,
Dna dna,
int const_pool_count)
Reads the constant pool table from the given stream. |
ConstantInfo |
get(int index)
Get a reference to the entry stored at the provided index. |
Dna |
getDna()
Get the Dna container |
java.lang.String |
getEntryType(int index)
This method returns a human readable definition of the type of the entry references by the given index. |
int |
getIndexOf(ConstantInfo entry)
Return the index of the provided entry, if exists. |
Range |
getValidRange()
This method returns the admitted range for accessing the ConstantPoolTable. |
boolean |
isConstantClass(int index)
This method states whether the given index refers to a CONSTANT_Class_info or not. |
boolean |
isConstantDouble(int index)
This method states whether the given index refers to a CONSTANT_Double_info or not. |
boolean |
isConstantFieldRef(int index)
This method states whether the given index refers to a CONSTANT_Field_info or not. |
boolean |
isConstantFloat(int index)
This method states whether the given index refers to a CONSTANT_Float_info or not. |
boolean |
isConstantInteger(int index)
This method states whether the given index refers to a CONSTANT_Integer_info or not. |
boolean |
isConstantInterfaceMethodRef(int index)
This method states whether the given index refers to a CONSTANT_InterfaceMethodref_info or not. |
boolean |
isConstantLong(int index)
This method states whether the given index refers to a CONSTANT_Long_info or not. |
boolean |
isConstantMethodRef(int index)
This method states whether the given index refers to a CONSTANT_Method_info or not. |
boolean |
isConstantNameAndType(int index)
This method states whether the given index refers to a CONSTANT_NameAndType_info or not. |
boolean |
isConstantString(int index)
This method states whether the given index refers to a CONSTANT_String_info or not. |
boolean |
isConstantUTF8(int index)
This method states whether the given index refers to a CONSTANT_Utf8_info or not. |
boolean |
isIndexValid(int index)
This methods states whether the specified index index is valid within the
constant pool table according to the class file specification. |
int |
remove(ConstantInfo entry,
boolean compact)
Removes the specified entry, if exists, resizing the constant pool table if compact is true, otherwise the removed entry has to be
replaced by null |
ConstantInfo |
remove(int index,
boolean compact)
Removes the entry at the specified index, if exists, resizing the constant pool table if compact is true, otherwise the removed entry has to be
replaced by null |
void |
setDna(Dna dna)
Set the Dna container |
int |
size()
Returns the number of entries contained |
void |
toStream(java.io.DataOutputStream dos)
Writes the constant pool table to the given output stream. |
void |
validate()
This method validates the current Constant Pool Table along with its entries. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static Logger logger
| Constructor Detail |
|---|
public CPTable()
| Method Detail |
|---|
public void addElement(ConstantInfo entry)
ConstantInfo at the end of the constant pool table.
addElement in interface ConstantPoolTableentry - The entry to be added
public void addElementAt(ConstantInfo entry,
int index,
boolean overwrite)
throws java.lang.IndexOutOfBoundsException,
java.lang.UnsupportedOperationException
ConstantInfo at the provided position, shifting of one
index any subsequente entry (if exists) iff the overwrite parameter is set to
false, otherwise the current entry at index index will be
overwritten.
addElementAt in interface ConstantPoolTableentry - The entry to be addedindex - The position at which the entry should be placedoverwrite - Should any existing entry be overwritten?
java.lang.IndexOutOfBoundsException - Trying to access to an invalid index
java.lang.UnsupportedOperationException - The method is not supported by the current implementation
public ConstantInfo get(int index)
throws java.lang.IndexOutOfBoundsException
get in interface ConstantPoolTableindex - The index to access to
java.lang.IndexOutOfBoundsException - Tying to acces to an invalid index
public int getIndexOf(ConstantInfo entry)
throws ConstantInfoNotFoundException,
java.lang.UnsupportedOperationException
getIndexOf in interface ConstantPoolTableentry - The entry whose index has to be returned
ConstantInfoNotFoundException - The provided entry is not stored within the current constant pool table
java.lang.UnsupportedOperationException - The method is not supported by the current implementation
public int remove(ConstantInfo entry,
boolean compact)
throws ConstantInfoNotFoundException,
java.lang.UnsupportedOperationException
compact is true, otherwise the removed entry has to be
replaced by null
remove in interface ConstantPoolTableentry - The entry we want to removecompact - Has the constant pool table to be resized?
ConstantInfoNotFoundException - The provided entry is not stored within the current constant pool table
java.lang.UnsupportedOperationException - The method is not supported by the current implementation
public ConstantInfo remove(int index,
boolean compact)
throws java.lang.IndexOutOfBoundsException,
java.lang.UnsupportedOperationException
compact is true, otherwise the removed entry has to be
replaced by null
remove in interface ConstantPoolTableindex - The index of the entry we want to removecompact - Has the constant pool table to be resized?
java.lang.IndexOutOfBoundsException - Tying to acces to an invalid index
java.lang.UnsupportedOperationException - The method is not supported by the current implementationpublic int size()
size in interface ConstantPoolTablepublic void addAll(ConstantPoolTable cpt)
ConstantPoolTable to the current one.
addAll in interface ConstantPoolTablecpt - The ConstantPoolTable to be appended
public void fromStream(java.io.DataInputStream dis,
Dna dna,
int const_pool_count)
throws MissingDnaContainerException,
DnaDeserializationException
ConstantPoolTable
fromStream in interface ConstantPoolTabledis - The stream for reading the constant pool table fromdna - The Dna container instanceconst_pool_count - The number of expected constant pool table entries
MissingDnaContainerException - This exception is thrown iff no valid Dna instance has been set
DnaDeserializationException
public void toStream(java.io.DataOutputStream dos)
throws MissingDnaContainerException,
DnaSerializationException
ConstantPoolTable
toStream in interface ConstantPoolTabledos - The stream for writing the Dna instance to
MissingDnaContainerException - This exception is thrown iff no valid Dna instance has been set
DnaSerializationException - Something went wrong either accessing or reading from the input streampublic Dna getDna()
ConstantPoolTableDna container
getDna in interface ConstantPoolTableDna containerpublic void setDna(Dna dna)
Dna container
setDna in interface ConstantPoolTabledna - The Dna container
public void validate()
throws ConstantInfoValidationException,
ConstantInfoAttributeOutOfRangeException,
MissingDnaContainerException,
MissingCPTableException
ConstantPoolTable
validate in interface ConstantPoolTableConstantInfoValidationException - Something failed with the validation process; further information are stored
within the raised exception
ConstantInfoAttributeOutOfRangeException - This exception is thrown whenever a constant pool table element refers to an
invalid constant pool table entry
MissingDnaContainerException - The validation process cannot be accomplished since any of the examined entities
is missing its own Dna container
MissingCPTableException - The validation process cannot be accomplished since there is no reference to the
ConstantPoolTable in the current Dna instancepublic boolean isIndexValid(int index)
index is valid within the
constant pool table according to the class file specification.
isIndexValid in interface ConstantPoolTableindex - The index whose validity has to be checked
true iff the index is valid, false otherwise
public boolean isConstantUTF8(int index)
throws IndexOutOfRangeException
ConstantPoolTable
isConstantUTF8 in interface ConstantPoolTableindex - The index whose entry has to be inspected
True or False according to the test result
IndexOutOfRangeException - The specified index is out of the valid range
public boolean isConstantFieldRef(int index)
throws IndexOutOfRangeException
ConstantPoolTable
isConstantFieldRef in interface ConstantPoolTableindex - The index whose entry has to be inspected
True or False according to the test result
IndexOutOfRangeException - The specified index is out of the valid range
public boolean isConstantMethodRef(int index)
throws IndexOutOfRangeException
ConstantPoolTable
isConstantMethodRef in interface ConstantPoolTableindex - The index whose entry has to be inspected
True or False according to the test result
IndexOutOfRangeException - The specified index is out of the valid range
public boolean isConstantInterfaceMethodRef(int index)
throws IndexOutOfRangeException
ConstantPoolTable
isConstantInterfaceMethodRef in interface ConstantPoolTableindex - The index whose entry has to be inspected
True or False according to the test result
IndexOutOfRangeException - The specified index is out of the valid range
public boolean isConstantString(int index)
throws IndexOutOfRangeException
ConstantPoolTable
isConstantString in interface ConstantPoolTableindex - The index whose entry has to be inspected
True or False according to the test result
IndexOutOfRangeException - The specified index is out of the valid range
public boolean isConstantInteger(int index)
throws IndexOutOfRangeException
ConstantPoolTable
isConstantInteger in interface ConstantPoolTableindex - The index whose entry has to be inspected
True or False according to the test result
IndexOutOfRangeException - The specified index is out of the valid range
public boolean isConstantFloat(int index)
throws IndexOutOfRangeException
ConstantPoolTable
isConstantFloat in interface ConstantPoolTableindex - The index whose entry has to be inspected
True or False according to the test result
IndexOutOfRangeException - The specified index is out of the valid range
public boolean isConstantLong(int index)
throws IndexOutOfRangeException
ConstantPoolTable
isConstantLong in interface ConstantPoolTableindex - The index whose entry has to be inspected
True or False according to the test result
IndexOutOfRangeException - The specified index is out of the valid range
public boolean isConstantDouble(int index)
throws IndexOutOfRangeException
ConstantPoolTable
isConstantDouble in interface ConstantPoolTableindex - The index whose entry has to be inspected
True or False according to the test result
IndexOutOfRangeException - The specified index is out of the valid range
public boolean isConstantNameAndType(int index)
throws IndexOutOfRangeException
ConstantPoolTable
isConstantNameAndType in interface ConstantPoolTableindex - The index whose entry has to be inspected
True or False according to the test result
IndexOutOfRangeException - The specified index is out of the valid range
public boolean isConstantClass(int index)
throws IndexOutOfRangeException
ConstantPoolTable
isConstantClass in interface ConstantPoolTableindex - The index whose entry has to be inspected
True or False according to the test result
IndexOutOfRangeException - The specified index is out of the valid rangepublic java.lang.String getEntryType(int index)
ConstantPoolTableindex.
getEntryType in interface ConstantPoolTableindex - The index whose entry type we are interested in
null if the index is out of the admitted
rangepublic Range getValidRange()
ConstantPoolTableConstantPoolTable.
getValidRange in interface ConstantPoolTableConstantPoolTable
or null should the ConstantPoolTable be empty.
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
ConstantPoolTable instance.
This method will not modify the reference to the
containing Dna instance.
clone in interface ConstantPoolTableclone in class java.lang.Objectjava.lang.CloneNotSupportedException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||