Class CodeWriter
java.lang.Object
com.ibm.wala.shrike.shrikeCT.ClassWriter.Element
com.ibm.wala.shrike.shrikeCT.CodeWriter
This class helps emit Code elements.
After constructing a CodeWriter, at least the max stack, max locals and bytecode bytes must be set before it can be used.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcopyInto(byte[] buf, int offset) Copy the bytes into 'buf' at offset 'offset'.intintgetSize()voidsetAttributes(ClassWriter.Element[] attributes) Set the attributes of this Code.voidsetCode(byte[] code) Set the bytecodes for this Code attribute.voidsetMaxLocals(int maxLocals) Set the maximum number of local variable space used, in words, by this Code.voidsetMaxStack(int maxStack) Set the maximum stack size, in words, in this Code.voidsetRawHandlers(int[] exnHandlers) Set the raw handler data for this Code attribute.
-
Constructor Details
-
CodeWriter
Build an empty serializable Code attribute.- Throws:
IllegalArgumentException- if w is null
-
-
Method Details
-
getCodeLength
- Throws:
IllegalStateException
-
getSize
- Specified by:
getSizein classClassWriter.Element- Returns:
- the number of bytes that will be generated.
- Throws:
IllegalArgumentException
-
copyInto
Description copied from class:ClassWriter.ElementCopy the bytes into 'buf' at offset 'offset'.- Specified by:
copyIntoin classClassWriter.Element- Returns:
- the number of bytes copies, which must be equal to getSize()
- Throws:
IllegalArgumentException
-
setCode
Set the bytecodes for this Code attribute.- Throws:
IllegalArgumentException- if code is null
-
setRawHandlers
public void setRawHandlers(int[] exnHandlers) Set the raw handler data for this Code attribute.- Parameters:
exnHandlers- a flattened sequence of (startPC, endPC, catchClassIndex, catchPC) tuples- Throws:
IllegalArgumentException- if exnHandlers is null
-
setMaxLocals
public void setMaxLocals(int maxLocals) Set the maximum number of local variable space used, in words, by this Code. -
setMaxStack
public void setMaxStack(int maxStack) Set the maximum stack size, in words, in this Code. -
setAttributes
Set the attributes of this Code.
-