Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.chaoswg.xtc4y.classdesc
Class CodeAttribute  view CodeAttribute download CodeAttribute.java

java.lang.Object
  extended bycom.chaoswg.xtc4y.classdesc.Attribute
      extended bycom.chaoswg.xtc4y.classdesc.CodeAttribute

public class CodeAttribute
extends Attribute

This class describes the information for a code attribute ($4.7.3) TBD: replace the byte array representing the code by a code class thorugh which easily the code may be changed an extended and all the indices may be checked (as with the constant pool)


Field Summary
private  java.util.Vector attributes
           
private  com.chaoswg.xtc4y.classdesc.code.Code code
           
private static short DEFAULT_MAX_LOCALS
           
private static short DEFAULT_MAX_STACK
           
private  java.util.Vector exceptions
           
private  short maxLocals
           
private  short maxStack
           
static java.lang.String NAME
           
 
Constructor Summary
  CodeAttribute(com.chaoswg.xtc4y.classdesc.code.Code code)
          Construct a new code attribute with default values except the code part.
protected CodeAttribute(java.io.DataInputStream dis, ConstantPool cp, int length)
          Creates a CodeAttribute and initializes it from a DataInputStream The attribute name and length of the attribute information was already read.
 
Method Summary
 void addAttribute(AttributeInfo attribute)
          Add an attribute
 void addException(ExceptionInfo exception)
          Add an exception
 AttributeInfo[] getAttributes()
           
 com.chaoswg.xtc4y.classdesc.code.Code getCode()
           
 ExceptionInfo[] getExceptions()
           
 short getMaxLocals()
           
 short getMaxStack()
           
 java.lang.String getName()
           
 void removeAttribute(AttributeInfo attribute)
          Remove an attribute
 void removeException(ExceptionInfo exception)
          Remove an exception
 void setCode(com.chaoswg.xtc4y.classdesc.code.Code code)
          Set the new byte array of code
 void setMaxLocals(short maxLocals)
          Set the new max locals
 void setMaxStack(short maxStack)
          Set the new max stack
 java.lang.String toString()
          Write in a readable way
protected  void writeAttribute(java.io.DataOutputStream dos, ConstantPool cp)
          Write the attribute information onto the DataOutputStream, using the constant pool to register variables.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

maxStack

private short maxStack

maxLocals

private short maxLocals

code

private com.chaoswg.xtc4y.classdesc.code.Code code

exceptions

private java.util.Vector exceptions

attributes

private java.util.Vector attributes

NAME

public static final java.lang.String NAME
See Also:
Constant Field Values

DEFAULT_MAX_STACK

private static final short DEFAULT_MAX_STACK
See Also:
Constant Field Values

DEFAULT_MAX_LOCALS

private static final short DEFAULT_MAX_LOCALS
See Also:
Constant Field Values
Constructor Detail

CodeAttribute

protected CodeAttribute(java.io.DataInputStream dis,
                        ConstantPool cp,
                        int length)
                 throws java.io.IOException
Creates a CodeAttribute and initializes it from a DataInputStream The attribute name and length of the attribute information was already read.


CodeAttribute

public CodeAttribute(com.chaoswg.xtc4y.classdesc.code.Code code)
Construct a new code attribute with default values except the code part. The exceptions and attributes are initializes to be empty

Method Detail

writeAttribute

protected void writeAttribute(java.io.DataOutputStream dos,
                              ConstantPool cp)
                       throws java.io.IOException
Write the attribute information onto the DataOutputStream, using the constant pool to register variables. The Attribute name and the length of the information will already be written. A specific attribute implementation should overwrite this method.

Specified by:
writeAttribute in class Attribute

getMaxStack

public short getMaxStack()

getMaxLocals

public short getMaxLocals()

getCode

public com.chaoswg.xtc4y.classdesc.code.Code getCode()

getExceptions

public ExceptionInfo[] getExceptions()

addException

public void addException(ExceptionInfo exception)
Add an exception


removeException

public void removeException(ExceptionInfo exception)
Remove an exception


getAttributes

public AttributeInfo[] getAttributes()

addAttribute

public void addAttribute(AttributeInfo attribute)
Add an attribute


removeAttribute

public void removeAttribute(AttributeInfo attribute)
Remove an attribute


setMaxStack

public void setMaxStack(short maxStack)
Set the new max stack


setMaxLocals

public void setMaxLocals(short maxLocals)
Set the new max locals


setCode

public void setCode(com.chaoswg.xtc4y.classdesc.code.Code code)
Set the new byte array of code


getName

public java.lang.String getName()
Specified by:
getName in class Attribute

toString

public java.lang.String toString()
Write in a readable way

Overrides:
toString in class Attribute