|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ConstantPoolTable
This interface defines the methods every ConstantPoolTable
implementation has to
provide. Instances of ConstantPoolTable
will be contained within Dna
instances.
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 cptSize)
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 stored by the constant pool table |
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. |
Method Detail |
---|
void addElement(ConstantInfo entry)
ConstantInfo
at the end of the constant pool table.
entry
- The entry to be addedvoid 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.
entry
- 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 implementationConstantInfo get(int index) throws java.lang.IndexOutOfBoundsException
index
- The index to access to
java.lang.IndexOutOfBoundsException
- Tying to acces to an invalid indexint getIndexOf(ConstantInfo entry) throws ConstantInfoNotFoundException, java.lang.UnsupportedOperationException
entry
- 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 implementationConstantInfo 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
index
- 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 implementationint remove(ConstantInfo entry, boolean compact) throws ConstantInfoNotFoundException, java.lang.UnsupportedOperationException
compact
is true
, otherwise the removed entry has to be
replaced by null
entry
- 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 implementationint size()
void addAll(ConstantPoolTable cpt)
ConstantPoolTable
to the current one.
cpt
- The ConstantPoolTable
to be appendedjava.lang.Object clone() throws java.lang.CloneNotSupportedException
ConstantPoolTable
instance.
java.lang.CloneNotSupportedException
void fromStream(java.io.DataInputStream dis, Dna dna, int cptSize) throws MissingDnaContainerException, DnaDeserializationException
dis
- The stream for reading the constant pool table fromdna
- The Dna
container instancecptSize
- The number of expected constant pool table entries
MissingDnaContainerException
- This exception is thrown iff no valid Dna
instance has been set
DnaDeserializationException
void toStream(java.io.DataOutputStream dos) throws MissingDnaContainerException, DnaSerializationException
dos
- 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 streamvoid setDna(Dna dna)
Dna
container
dna
- The Dna
containerDna getDna()
Dna
container
Dna
containerboolean isIndexValid(int index)
index
is valid within the
constant pool table according to the class file specification.
index
- The index whose validity has to be checked
true
iff the index is valid, false
otherwiseboolean isConstantUTF8(int index) throws IndexOutOfRangeException
index
- 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 rangeboolean isConstantClass(int index) throws IndexOutOfRangeException
index
- 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 rangeboolean isConstantFieldRef(int index) throws IndexOutOfRangeException
index
- 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 rangeboolean isConstantMethodRef(int index) throws IndexOutOfRangeException
index
- 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 rangeboolean isConstantInterfaceMethodRef(int index) throws IndexOutOfRangeException
index
- 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 rangeboolean isConstantString(int index) throws IndexOutOfRangeException
index
- 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 rangeboolean isConstantInteger(int index) throws IndexOutOfRangeException
index
- 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 rangeboolean isConstantFloat(int index) throws IndexOutOfRangeException
index
- 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 rangeboolean isConstantLong(int index) throws IndexOutOfRangeException
index
- 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 rangeboolean isConstantDouble(int index) throws IndexOutOfRangeException
index
- 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 rangeboolean isConstantNameAndType(int index) throws IndexOutOfRangeException
index
- 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 rangejava.lang.String getEntryType(int index)
index
.
index
- The index whose entry type we are interested in
null
if the index is out of the admitted
rangeRange getValidRange()
ConstantPoolTable
.
ConstantPoolTable
or null
should the ConstantPoolTable
be empty.void validate() throws ConstantInfoValidationException, ConstantInfoAttributeOutOfRangeException, MissingDnaContainerException, MissingCPTableException
ConstantInfoValidationException
- 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
instance
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |