public final class Code extends Attribute
Code_attribute { u2 attribute_name_index; u4 attribute_length; u2 max_stack; u2 max_locals; u4 code_length; u1 code[code_length]; u2 exception_table_length; { u2 start_pc; u2 end_pc; u2 handler_pc; u2 catch_type; } exception_table[exception_table_length]; u2 attributes_count; attribute_info attributes[attributes_count]; }
Attribute
,
CodeException
,
LineNumberTable
,
LocalVariableTable
constant_pool, EMPTY_ARRAY, length, name_index, tag
Constructor and Description |
---|
Code(Code code)
Initialize from another object.
|
Code(int nameIndex,
int length,
int maxStack,
int maxLocals,
byte[] code,
CodeException[] exceptionTable,
Attribute[] attributes,
ConstantPool constantPool) |
Modifier and Type | Method and Description |
---|---|
void |
accept(Visitor v)
Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.
|
Attribute |
copy(ConstantPool constantPool) |
void |
dump(DataOutputStream file)
Dump code attribute to file stream in binary format.
|
Attribute[] |
getAttributes() |
byte[] |
getCode() |
CodeException[] |
getExceptionTable() |
LineNumberTable |
getLineNumberTable() |
LocalVariableTable |
getLocalVariableTable() |
int |
getMaxLocals() |
int |
getMaxStack() |
void |
setAttributes(Attribute[] attributes) |
void |
setCode(byte[] code) |
void |
setExceptionTable(CodeException[] exceptionTable) |
void |
setMaxLocals(int maxLocals) |
void |
setMaxStack(int maxStack) |
String |
toString() |
String |
toString(boolean verbose)
Converts this object to a String.
|
addAttributeReader, addAttributeReader, clone, getConstantPool, getLength, getName, getNameIndex, getTag, println, readAttribute, readAttribute, removeAttributeReader, setConstantPool, setLength, setNameIndex
public Code(Code code)
code
- The source Code.public Code(int nameIndex, int length, int maxStack, int maxLocals, byte[] code, CodeException[] exceptionTable, Attribute[] attributes, ConstantPool constantPool)
nameIndex
- Index pointing to the name Codelength
- Content length in bytesmaxStack
- Maximum size of stackmaxLocals
- Number of local variablescode
- Actual byte codeexceptionTable
- of handled exceptionsattributes
- Attributes of code: LineNumber or LocalVariableconstantPool
- Array of constantspublic void accept(Visitor v)
public Attribute copy(ConstantPool constantPool)
public void dump(DataOutputStream file) throws IOException
dump
in class Attribute
file
- Output file streamIOException
- if an I/O error occurs.public Attribute[] getAttributes()
Attribute
public byte[] getCode()
public CodeException[] getExceptionTable()
CodeException
public LineNumberTable getLineNumberTable()
public LocalVariableTable getLocalVariableTable()
public int getMaxLocals()
public int getMaxStack()
public void setAttributes(Attribute[] attributes)
attributes
- the attributes to set for this Codepublic void setCode(byte[] code)
code
- byte codepublic void setExceptionTable(CodeException[] exceptionTable)
exceptionTable
- exception tablepublic void setMaxLocals(int maxLocals)
maxLocals
- maximum number of local variablespublic void setMaxStack(int maxStack)
maxStack
- maximum stack sizepublic String toString()
public String toString(boolean verbose)
verbose
- Provides verbose output when true.Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.