Apache Tomcat 7.0.37

org.apache.tomcat.util.bcel.classfile
Class Code

java.lang.Object
  extended by org.apache.tomcat.util.bcel.classfile.Attribute
      extended by org.apache.tomcat.util.bcel.classfile.Code
All Implemented Interfaces:
Serializable, Cloneable

public final class Code
extends Attribute

This class represents a chunk of Java byte code contained in a method. It is instantiated by the Attribute.readAttribute() method. A Code attribute contains informations about operand stack, local variables, byte code and the exceptions handled within this method. This attribute has attributes itself, namely LineNumberTable which is used for debugging purposes and LocalVariableTable which contains information about the local variables.

Version:
$Id: Code.java 1377533 2012-08-26 22:22:59Z markt $
Author:
M. Dahm
See Also:
Attribute, CodeException, LineNumberTable, LocalVariableTable, Serialized Form

Field Summary
 
Fields inherited from class org.apache.tomcat.util.bcel.classfile.Attribute
constant_pool, length, name_index, tag
 
Constructor Summary
Code(int name_index, int length, int max_stack, int max_locals, byte[] code, CodeException[] exception_table, Attribute[] attributes, ConstantPool constant_pool)
           
 
Method Summary
 Attribute copy(ConstantPool _constant_pool)
           
 LocalVariableTable getLocalVariableTable()
           
 void setAttributes(Attribute[] attributes)
           
 void setCode(byte[] code)
           
 void setExceptionTable(CodeException[] exception_table)
           
 String toString()
           
 String toString(boolean verbose)
           
 
Methods inherited from class org.apache.tomcat.util.bcel.classfile.Attribute
clone, getName, getTag, readAttribute
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Code

public Code(int name_index,
            int length,
            int max_stack,
            int max_locals,
            byte[] code,
            CodeException[] exception_table,
            Attribute[] attributes,
            ConstantPool constant_pool)
Parameters:
name_index - Index pointing to the name Code
length - Content length in bytes
max_stack - Maximum size of stack
max_locals - Number of local variables
code - Actual byte code
exception_table - Table of handled exceptions
attributes - Attributes of code: LineNumber or LocalVariable
constant_pool - Array of constants
Method Detail

getLocalVariableTable

public LocalVariableTable getLocalVariableTable()
Returns:
LocalVariableTable of Code, if it has one

setAttributes

public final void setAttributes(Attribute[] attributes)
Parameters:
attributes - the attributes to set for this Code

setCode

public final void setCode(byte[] code)
Parameters:
code - byte code

setExceptionTable

public final void setExceptionTable(CodeException[] exception_table)
Parameters:
exception_table - exception table

toString

public final String toString(boolean verbose)
Returns:
String representation of code chunk.

toString

public final String toString()
Overrides:
toString in class Attribute
Returns:
String representation of code chunk.

copy

public Attribute copy(ConstantPool _constant_pool)
Specified by:
copy in class Attribute
Parameters:
_constant_pool - the constant pool to duplicate
Returns:
deep copy of this attribute

Apache Tomcat 7.0.37

Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.