public class Method extends java.lang.Object implements MethodInfo
Code,
Exceptions| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEBUG |
| Constructor and Description |
|---|
Method(java.io.DataInputStream in,
ClassInfo classInfo)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone()
Creates a clone of this MethodInfo except that its declaring
class does not know about it.
|
byte[] |
code()
Get the byte code array of the method.
|
int |
codeLength()
Returns the length of the Code array.
|
ClassInfo |
declaringClass()
Get the class which declared the method.
|
Catch[] |
exceptionHandlers()
Get the exception handlers in the method.
|
int[] |
exceptionTypes()
Get the indices into the constant pool of the types of the exceptions
thrown by the method.
|
LineNumberDebugInfo[] |
lineNumbers()
Get the line numbers of the instructions in the method.
|
LocalDebugInfo[] |
locals()
Get the local variable debug info for the method.
|
int |
maxLocals()
Get the maximum number of locals used in the method.
|
int |
maxStack()
Get the maximum height of the operand stack.
|
int |
modifiers()
Get the modifiers of the method.
|
int |
nameIndex()
Get the index into the constant pool of the name of the method.
|
void |
setCode(byte[] bytes)
Set the byte code array of the method.
|
void |
setExceptionHandlers(Catch[] handlers)
Set the exception handlers in the method.
|
void |
setLineNumbers(LineNumberDebugInfo[] lineNumbers)
Set the line numbers of the instructions in the method.
|
void |
setLocals(LocalDebugInfo[] locals)
Set the local variable debug info for the method.
|
void |
setMaxLocals(int maxLocals)
Set the maximum number of locals used in the method.
|
void |
setMaxStack(int maxStack)
Set the maximum height of the operand stack.
|
void |
setModifiers(int modifiers)
Set the modifiers of the method.
|
void |
setNameIndex(int name)
Set the index into the constant pool of the name of the method.
|
void |
setTypeIndex(int type)
Set the index into the constant pool of the type of the method.
|
java.lang.String |
toString()
Returns a string representation of the method.
|
int |
typeIndex()
Get the index into the constant pool of the type of the method.
|
void |
write(java.io.DataOutputStream out)
Write the method to a class file.
|
public Method(java.io.DataInputStream in,
ClassInfo classInfo)
throws java.io.IOException
in - The data stream of the class file.classInfo - The class file containing the method.java.io.IOException - If an error occurs while reading.public ClassInfo declaringClass()
declaringClass in interface MethodInfopublic void setNameIndex(int name)
setNameIndex in interface MethodInfoname - The index into the constant pool of the name of the method.public void setTypeIndex(int type)
setTypeIndex in interface MethodInfotype - The index into the constant pool of the type of the method.public int nameIndex()
nameIndex in interface MethodInfopublic int typeIndex()
typeIndex in interface MethodInfopublic void setModifiers(int modifiers)
setModifiers in interface MethodInfomodifiers - A bit vector of modifier flags for the method.Modifierspublic int modifiers()
modifiers in interface MethodInfoModifierspublic int maxStack()
maxStack in interface MethodInfopublic void setMaxStack(int maxStack)
setMaxStack in interface MethodInfomaxStack - The maximum height of the operand stack.public int maxLocals()
maxLocals in interface MethodInfopublic void setMaxLocals(int maxLocals)
setMaxLocals in interface MethodInfomaxLocals - The maximum number of locals used in the method.public byte[] code()
code in interface MethodInfopublic int codeLength()
public void setCode(byte[] bytes)
setCode in interface MethodInfobytes - The byte code array of the method.public int[] exceptionTypes()
exceptionTypes in interface MethodInfopublic void setLineNumbers(LineNumberDebugInfo[] lineNumbers)
setLineNumbers in interface MethodInfolineNumbers - The line numbers of the instructions in the method.public void setLocals(LocalDebugInfo[] locals)
setLocals in interface MethodInfolocals - The local variable debug info for the method.public LineNumberDebugInfo[] lineNumbers()
lineNumbers in interface MethodInfopublic LocalDebugInfo[] locals()
locals in interface MethodInfopublic Catch[] exceptionHandlers()
exceptionHandlers in interface MethodInfopublic void setExceptionHandlers(Catch[] handlers)
setExceptionHandlers in interface MethodInfohandlers - The exception handlers in the method.public void write(java.io.DataOutputStream out)
throws java.io.IOException
out - The data stream of the class file.java.io.IOException - If an error occurs while writing.public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.Object clone()
clone in interface MethodInfoclone in class java.lang.Object