javar.attributes
Class MethodCode

java.lang.Object
  |
  +--javar.attributes.Attribute
        |
        +--javar.attributes.MethodCode

public class MethodCode
extends Attribute

This is an attribute of a method which contains the data for the code :)

Author:
Ben Litchfield

Field Summary
 
Fields inherited from class javar.attributes.Attribute
nameIndex, pool
 
Constructor Summary
MethodCode(ConstantPool p, long name)
          Constructor
 
Method Summary
 byte[] getCode()
          This will return the code that this attribute holds
 CodeHandler[] getHandlers()
          This will get the handlers that this attribute has.
 long getMaxLocals()
          This will get the maximum number of locals.
 long getMaxStack()
          This will get the maximum stack size.
 void load(DataInputStream in)
          This will load the contents of an attribute
 void setCode(byte[] newCode)
          This will set the code that makes this method
 void setMaxLocals(long size)
          This will set the maximum number of locals;
 void setMaxStack(long size)
          This will set the maximum stack size.
 byte[] toBytes()
          This will take this attribute and convert it into an array of bytes that can be stored in a classfile.
 String toString()
          This will return a string for this attribute, useful only for debugging
 
Methods inherited from class javar.attributes.Attribute
getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MethodCode

public MethodCode(ConstantPool p,
                  long name)
Constructor

Method Detail

toString

public String toString()
This will return a string for this attribute, useful only for debugging

Overrides:
toString in class Attribute

toBytes

public byte[] toBytes()
This will take this attribute and convert it into an array of bytes that can be stored in a classfile.

Specified by:
toBytes in class Attribute
Returns:
array of bytes representing this attribute

load

public void load(DataInputStream in)
This will load the contents of an attribute

Specified by:
load in class Attribute
Parameters:
in - the stream to get the data from

setCode

public void setCode(byte[] newCode)
This will set the code that makes this method

Parameters:
newCode - The new code for this method

getCode

public byte[] getCode()
This will return the code that this attribute holds

Returns:
The code that makes this method

getHandlers

public CodeHandler[] getHandlers()
This will get the handlers that this attribute has. A handler is basically a try catch block

Returns:
the list of handlers

getMaxStack

public long getMaxStack()
This will get the maximum stack size.

Returns:
the stack size

setMaxStack

public void setMaxStack(long size)
This will set the maximum stack size.

Parameters:
size - The new size of the stack

getMaxLocals

public long getMaxLocals()
This will get the maximum number of locals.

Returns:
the stack size

setMaxLocals

public void setMaxLocals(long size)
This will set the maximum number of locals;

Parameters:
size - The new size of the stack