Fields Summary |
---|
private int | attributeNameIndexindex into constant pool table containing the name
of this class |
private int | attributeLengthlength of this attribute in bytes |
private int | maxStackthe maximum depth of the operand stack of this method |
private int | maxLocalsthe number of local variables in the local variable
array allocated upon invocation of this method |
private int | codeLengththe number of bytes in the code array for this method |
private byte[] | codethe bytes of Java virtual machine code that implement a method |
private int | exceptionTableLengththe number of entries in the exceptionTable table |
private ExceptionTable[] | exceptionTableeach entry describes one exception handler in the code array |
private int | attributesCountthe number of attributes of the Code attribute |
private AttributeInfo[] | attributesarray of attributes for this CodeAttribute |
Methods Summary |
---|
public boolean | containsLine(int lineNumber)Query this code attribute to see if it contains the source file
line number specified by lineNumber.
//get the line number table
LineNumberTableAttribute lines = getLineNumberTable ();
//if the line number table was found tell it to look up the line number
if (lines != null)
return (lines.containsLine (lineNumber));
else
return false; //could not find the line number table so return false
|
public int | getAttributeCount()
return attributesCount;
|
public AttributeInfo[] | getAttributes()
return attributes;
|
public byte[] | getByteCodes()Returns the byte code for the method
byte[] ret = new byte[ code.length ];
System.arraycopy( code, 0, ret, 0, code.length );
return ret;
|
public int | getCodeLength()
return codeLength;
|
public LineNumberTableAttribute | getLineNumberTable()Retrieves the line number table of this code attribute
int attrIndex = 0;
boolean found = false;
//loop through this code attribute's attributes until the line number
//table is found or there are no more to look through
while ((!found) && (attrIndex < attributesCount))
{
if (attributes[attrIndex].getType () == AttributeInfo.ATTR_LINENUMBER)
found = true;
else
++attrIndex;
}
if (found)
{//if we found the line number table return it
AttributeInfo attrInfo = attributes[attrIndex];
LineNumberTableAttribute lineNumberTable =
(LineNumberTableAttribute) attrInfo.getInfo ();
return lineNumberTable;
}
else
return null; //did not find the line number table so return null
|
public java.lang.String | toString(ConstantPoolInfo[] constantPool)Returns the CodeAttribute attribute in a nice easy to
read format as a string.
ConstantUtf8Info utf8Info;
String s = new String ("");
utf8Info = (ConstantUtf8Info) constantPool[attributeNameIndex];
s = s + utf8Info.toString ();
for (int lcv = 0; lcv < attributesCount; ++lcv)
s = s + "\n\t\t" + attributes[lcv].toString ();
return s;
|