org.apache.bcel.classfile
public final class Code extends Attribute
Attribute
,
CodeException
,
LineNumberTable
,
LocalVariableTable
,
Serialized FormModifier and Type | Field and Description |
---|---|
private Attribute[] |
attributes |
private int |
attributes_count |
private byte[] |
code |
private int |
code_length |
private CodeException[] |
exception_table |
private int |
exception_table_length |
private int |
max_locals |
private int |
max_stack |
constant_pool, length, name_index, tag
Constructor and Description |
---|
Code(Code c)
Initialize from another object.
|
Code(int name_index,
int length,
DataInputStream file,
ConstantPool constant_pool) |
Code(int name_index,
int length,
int max_stack,
int max_locals,
byte[] code,
CodeException[] exception_table,
Attribute[] attributes,
ConstantPool constant_pool) |
Modifier and Type | Method and Description |
---|---|
void |
accept(Visitor v)
Called by objects that are traversing the nodes of the tree implicitely
defined by the contents of a Java class.
|
private int |
calculateLength() |
Attribute |
copy(ConstantPool _constant_pool) |
void |
dump(DataOutputStream file)
Dump code attribute to file stream in binary format.
|
Attribute[] |
getAttributes() |
byte[] |
getCode() |
CodeException[] |
getExceptionTable() |
private int |
getInternalLength() |
LineNumberTable |
getLineNumberTable() |
LocalVariableTable |
getLocalVariableTable() |
int |
getMaxLocals() |
int |
getMaxStack() |
void |
setAttributes(Attribute[] attributes) |
void |
setCode(byte[] code) |
void |
setExceptionTable(CodeException[] exception_table) |
void |
setMaxLocals(int max_locals) |
void |
setMaxStack(int max_stack) |
String |
toString() |
String |
toString(boolean verbose) |
addAttributeReader, clone, getConstantPool, getLength, getNameIndex, getTag, readAttribute, removeAttributeReader, setConstantPool, setLength, setNameIndex
private int max_stack
private int max_locals
private int code_length
private byte[] code
private int exception_table_length
private CodeException[] exception_table
private int attributes_count
private Attribute[] attributes
public Code(Code c)
Code(int name_index, int length, DataInputStream file, ConstantPool constant_pool) throws IOException
name_index
- Index pointing to the name Codelength
- Content length in bytesfile
- Input streamconstant_pool
- Array of constantsIOException
public Code(int name_index, int length, int max_stack, int max_locals, byte[] code, CodeException[] exception_table, Attribute[] attributes, ConstantPool constant_pool)
name_index
- Index pointing to the name Codelength
- Content length in bytesmax_stack
- Maximum size of stackmax_locals
- Number of local variablescode
- Actual byte codeexception_table
- Table of handled exceptionsattributes
- Attributes of code: LineNumber or LocalVariableconstant_pool
- Array of constantspublic void accept(Visitor v)
public final void dump(DataOutputStream file) throws IOException
dump
in class Attribute
file
- Output file streamIOException
public final Attribute[] getAttributes()
Attribute
public LineNumberTable getLineNumberTable()
public LocalVariableTable getLocalVariableTable()
public final byte[] getCode()
public final CodeException[] getExceptionTable()
CodeException
public final int getMaxLocals()
public final int getMaxStack()
private final int getInternalLength()
private final int calculateLength()
public final void setAttributes(Attribute[] attributes)
attributes
- the attributes to set for this Codepublic final void setCode(byte[] code)
code
- byte codepublic final void setExceptionTable(CodeException[] exception_table)
exception_table
- exception tablepublic final void setMaxLocals(int max_locals)
max_locals
- maximum number of local variablespublic final void setMaxStack(int max_stack)
max_stack
- maximum stack sizepublic final String toString(boolean verbose)
public final String toString()
public Attribute copy(ConstantPool _constant_pool)