public final class CodeWriter extends ClassWriter.Element
After constructing a CodeWriter, at least the max stack, max locals and bytecode bytes must be set before it can be used.
| Constructor and Description |
|---|
CodeWriter(ClassWriter w)
Build an empty serializable Code attribute.
|
| Modifier and Type | Method and Description |
|---|---|
int |
copyInto(byte[] buf,
int offset)
Copy the bytes into 'buf' at offset 'offset'.
|
int |
getCodeLength() |
int |
getSize() |
void |
setAttributes(ClassWriter.Element[] attributes)
Set the attributes of this Code.
|
void |
setCode(byte[] code)
Set the bytecodes for this Code attribute.
|
void |
setMaxLocals(int maxLocals)
Set the maximum number of local variable space used, in words, by this Code.
|
void |
setMaxStack(int maxStack)
Set the maximum stack size, in words, in this Code.
|
void |
setRawHandlers(int[] exnHandlers)
Set the raw handler data for this Code attribute.
|
public CodeWriter(ClassWriter w)
java.lang.IllegalArgumentException - if w is nullpublic int getCodeLength()
throws java.lang.IllegalStateException
java.lang.IllegalStateExceptionpublic int getSize()
throws java.lang.IllegalArgumentException
getSize in class ClassWriter.Elementjava.lang.IllegalArgumentExceptionpublic int copyInto(byte[] buf,
int offset)
throws java.lang.IllegalArgumentException
ClassWriter.ElementcopyInto in class ClassWriter.Elementjava.lang.IllegalArgumentExceptionpublic void setCode(byte[] code)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException - if code is nullpublic void setRawHandlers(int[] exnHandlers)
exnHandlers - a flattened sequence of (startPC, endPC, catchClassIndex, catchPC) tuplesjava.lang.IllegalArgumentException - if exnHandlers is nullpublic void setMaxLocals(int maxLocals)
public void setMaxStack(int maxStack)
public void setAttributes(ClassWriter.Element[] attributes)