Overview | Package | Class | Tree | Deprecated | Index | Help
| Apache Tomcat 7.0.29
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

    java.lang.Object
      org.apache.tomcat.util.bcel.classfile.Attribute
          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 1181133 2011-10-10 18:49:14Z 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)`
`void` | `dump(DataOutputStream file)` Dump code attribute to file stream in binary format.
`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

### dump

    public final void dump(DataOutputStream file)
                    throws IOException

  Dump code attribute to file stream in binary format.

  Overrides:
    `dump` in class `Attribute`
  Parameters:
    `file` - Output file stream
  Throws:
    `IOException`

### 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

Overview | Package | Class | Tree | Deprecated | Index | Help
| Apache Tomcat 7.0.29
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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