|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectfr.umlv.corosol.classfile.attribute.impl.AbstractJAttribute
fr.umlv.corosol.classfile.attribute.impl.DefaultJCodeAttribute
public class DefaultJCodeAttribute
The default implementation of the JCodeAttribute interface.
| Field Summary |
|---|
| Fields inherited from interface fr.umlv.corosol.classfile.attribute.JAttribute |
|---|
CODE, CONSTANT_VALUE, DEPRECATED, EXCEPTIONS, INNER_CLASSES, LINE_NUMBER_TABLE, LOCAL_VARIABLE_TABLE, SOURCE_FILE, SYNTHETIC |
| Constructor Summary | |
|---|---|
DefaultJCodeAttribute()
The default constructor. |
|
DefaultJCodeAttribute(int maxStack,
int maxLocals,
byte[] byteCode)
Creates a new Code attribute. |
|
DefaultJCodeAttribute(int maxStack,
int maxLocals,
byte[] bytes,
JExceptionHandler[] handlers,
JAttribute[] attributes)
Creates a new Code attribute. |
|
| Method Summary | |
|---|---|
void |
addBytecode(int opcode)
Adds the specified byte code to the byte code handled by this Code attribute. |
void |
addBytecodes(byte[] b,
int off,
int len)
Adds len bytes from the specified byte array starting at offset off to the byte code handled by this Code attribute. |
void |
addByteOpBytecode(int opcode,
int operand)
Adds the specified byte code and its byte operand to the byte code handled by this Code attribute. |
void |
addClassOpBytecode(int opcode,
java.lang.String className)
Adds the specified byte code and its short operand determined by the name of a class. |
void |
addFieldOpBytecode(int opcode,
java.lang.String className,
java.lang.String name,
java.lang.String desc)
Adds the specified byte code and its short operand determined by the declaring class, the name and the descriptor of a field. |
void |
addIntOpBytecode(int opcode,
int operand)
Adds the specified byte code and its int operand to the byte code handled by this Code attribute. |
void |
addInvokeinterface(java.lang.String className,
java.lang.String name,
java.lang.String desc)
Adds the invokeinterface byte code and its short operand determined by the declaring class, the name and the descriptor of an interface method. |
void |
addMethodOpBytecode(int opcode,
java.lang.String className,
java.lang.String name,
java.lang.String desc)
Adds the specified byte code and its short operand determined by the declaring class, the name and the descriptor of a method. |
void |
addShortOpBytecode(int opcode,
int operand)
Adds the specified byte code and its short operand to the byte code handled by this Code attribute. |
JAttribute[] |
getAttributes()
Returns an array of attributes associated with this Code attribute. |
byte[] |
getByteCode()
Returns the bytes code of a method. |
JExceptionHandler[] |
getExceptionHandlers()
Returns an array containg the exception handlers in the byte code array of a method. |
int |
getMaxLocals()
Returns the number of local variables in the local variable array allocated upon invocation of a method, including the local variables used to pass parameters to this method on its invocation. |
int |
getMaxStack()
Returns the maximum depth of the operand stack at any point during execution of a method. |
java.lang.String |
getName()
Returns the attribute name. |
int |
getSize()
Returns the size of the attribute in bytes. |
void |
readItem(JClassFileInput in)
Extracts the data of this classfile part from the specified input stream. |
void |
setAttributes(JAttribute[] attributes)
Sets the optional attributes associated with this Code attribute. |
void |
setByteCode(byte[] bytes)
Sets the bytecode of a method whith the specified byte array. |
void |
setExceptionHandlers(JExceptionHandler[] handlers)
Sets the exception handlers in the byte code of a method. |
void |
setMaxLocals(int maxLocals)
Sets the number of local variables in the local variable array allocated upon invocation of a method, including the local variables used to pass parameters to this method on its invocation. |
void |
setMaxStack(int maxStack)
Sets the maximum depth of the operand stack at any point during execution of a method. |
java.lang.String |
toString()
Returns a string representation of this attribute. |
void |
writeItem(JClassFileOutput out)
Writes the data of this attribute into a file via the specified output stream. |
| Methods inherited from class fr.umlv.corosol.classfile.attribute.impl.AbstractJAttribute |
|---|
getConstantPool, setConstantPool |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface fr.umlv.corosol.classfile.JClassFileItem |
|---|
getConstantPool, setConstantPool |
| Constructor Detail |
|---|
public DefaultJCodeAttribute()
public DefaultJCodeAttribute(int maxStack,
int maxLocals,
byte[] bytes,
JExceptionHandler[] handlers,
JAttribute[] attributes)
maxStack - the max depth of the operand stackmaxLocals - the length of the local variables arraybytes - the byte code of the methodhandlers - an array of exception handlersattributes - an array of optional attributes
public DefaultJCodeAttribute(int maxStack,
int maxLocals,
byte[] byteCode)
maxStack - the max depth of the operand stackmaxLocals - the length of the local variables arraybyteCode - the byte code of the method| Method Detail |
|---|
public int getMaxStack()
getMaxStack in interface JCodeAttributepublic int getMaxLocals()
getMaxLocals in interface JCodeAttributepublic byte[] getByteCode()
getByteCode in interface JCodeAttributepublic JExceptionHandler[] getExceptionHandlers()
getExceptionHandlers in interface JCodeAttributepublic JAttribute[] getAttributes()
getAttributes in interface JCodeAttributepublic java.lang.String getName()
getName in interface JAttributegetName in class AbstractJAttributepublic int getSize()
getSize in interface JAttributegetSize in class AbstractJAttributepublic void setMaxStack(int maxStack)
setMaxStack in interface JCodeAttributemaxStack - the max size of the operand stack of a framepublic void setMaxLocals(int maxLocals)
setMaxLocals in interface JCodeAttributemaxLocals - the max size of the local variable array of a framepublic void setByteCode(byte[] bytes)
setByteCode in interface JCodeAttributebytes - the bytecode of a methodpublic void setExceptionHandlers(JExceptionHandler[] handlers)
setExceptionHandlers in interface JCodeAttributehandlers - the exception handlers of the byte code of a methodpublic void setAttributes(JAttribute[] attributes)
setAttributes in interface JCodeAttributeattributes - an array of optional attributespublic java.lang.String toString()
toString in interface JAttributetoString in class AbstractJAttribute
public void readItem(JClassFileInput in)
throws java.io.IOException
readItem in interface JClassFileItemin - a class file input stream
java.io.IOException - if an I/O error occurs when
reading the datas of this attribute
public void writeItem(JClassFileOutput out)
throws java.io.IOException
writeItem in interface JClassFileItemout - a class file output stream
java.io.IOException - if an I/O error occurs when
writing into the classfilepublic void addBytecode(int opcode)
addBytecode in interface JCodeAttributeopcode - the opcode of a byte code instruction
public void addByteOpBytecode(int opcode,
int operand)
addByteOpBytecode in interface JCodeAttributeopcode - the opcode of a byte code instructionoperand - the byte operand of the instruction
public void addShortOpBytecode(int opcode,
int operand)
addShortOpBytecode in interface JCodeAttributeopcode - the opcode of a byte code instructionoperand - the short operand of the instruction
public void addIntOpBytecode(int opcode,
int operand)
addIntOpBytecode in interface JCodeAttributeopcode - the opcode of a byte code instructionoperand - the int operand of the instruction
public void addBytecodes(byte[] b,
int off,
int len)
addBytecodes in interface JCodeAttributeb - the byte code data.off - the start offset in the data.len - the number of bytes to write.
public void addClassOpBytecode(int opcode,
java.lang.String className)
addClassOpBytecode in interface JCodeAttributeopcode - the opcode of a byte code instructionclassName - the name of a class
public void addMethodOpBytecode(int opcode,
java.lang.String className,
java.lang.String name,
java.lang.String desc)
addMethodOpBytecode in interface JCodeAttributeopcode - the opcode of a byte code instructionclassName - the declaring class of a methodname - the name of a methoddesc - the name of a method
public void addInvokeinterface(java.lang.String className,
java.lang.String name,
java.lang.String desc)
addInvokeinterface in interface JCodeAttributeclassName - the declaring class of an interface methodname - the name of an interface methoddesc - the name of an interface method
public void addFieldOpBytecode(int opcode,
java.lang.String className,
java.lang.String name,
java.lang.String desc)
addFieldOpBytecode in interface JCodeAttributeopcode - the opcode of a byte code instructionclassName - the declaring class of a fieldname - the name of a fielddesc - the name of a field
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||