Method Summary |
|
public int | append(byte[] code) Appends the given bytecode sequence at the end.
Parameters: code - the bytecode appended. |
public void | append(ExceptionTable et, int offset) Copies and appends the entries in the given exception table
at the end of the exception table in the code attribute
edited by this object. |
public void | appendGap(int gapLength) Appends a gap at the end of the bytecode sequence. |
public void | begin() Moves to the first instruction. |
public int | byteAt(int index) Returns the unsigned 8bit value at the given index. |
public CodeAttribute | get() Returns a Code attribute read with this iterator. |
public int | getCodeLength() Returns code_length of Code_attribute . |
public boolean | hasNext() Returns true if there is more instructions. |
public int | insert(byte[] code) Inserts the given bytecode sequence
before the next instruction that would be returned by
next() (not before the instruction returned
by tha last call to next() ).
Branch offsets and the exception table are also updated.
If the next instruction is at the beginning of a block statement,
then the bytecode is inserted within that block.
An extra gap may be inserted at the end of the inserted
bytecode sequence for adjusting alignment if the code attribute
includes LOOKUPSWITCH or TABLESWITCH .
Parameters: code - inserted bytecode sequence. |
public void | insert(int pos, byte[] code) Inserts the given bytecode sequence
before the instruction at the given index pos . |
public void | insert(ExceptionTable et, int offset) Copies and inserts the entries in the given exception table
at the beginning of the exception table in the code attribute
edited by this object. |
public int | insertEx(byte[] code) Inserts the given bytecode sequence exclusively
before the next instruction that would be returned by
next() (not before the instruction returned
by tha last call to next() ).
Branch offsets and the exception table are also updated.
If the next instruction is at the beginning of a block statement,
then the bytecode is excluded from that block.
An extra gap may be inserted at the end of the inserted
bytecode sequence for adjusting alignment if the code attribute
includes LOOKUPSWITCH or TABLESWITCH .
Parameters: code - inserted bytecode sequence. |
public void | insertEx(int pos, byte[] code) Inserts the given bytecode sequence exclusively
before the instruction at the given index pos . |
public int | insertExGap(int length) Inserts an exclusive gap
before the next instruction that would be returned by
next() (not before the instruction returned
by tha last call to next() ).
Branch offsets and the exception table are also updated.
The inserted gap is filled with NOP. |
public int | insertExGap(int pos, int length) Inserts an exclusive gap in front of the instruction at the given
index pos .
Branch offsets and the exception table are also updated.
The inserted gap is filled with NOP. |
public int | insertGap(int length) Inserts a gap
before the next instruction that would be returned by
next() (not before the instruction returned
by tha last call to next() ).
Branch offsets and the exception table are also updated.
The inserted gap is filled with NOP. |
public int | insertGap(int pos, int length) Inserts a gap in front of the instruction at the given
index pos .
Branch offsets and the exception table are also updated.
The inserted gap is filled with NOP. |
static byte[] | insertGap(byte[] code, int where, int gapLength, boolean exclusive, ExceptionTable etable, CodeAttribute ca) |
public int | lookAhead() Obtains the value that the next call
to next() will return. |
public void | move(int index) Moves to the given index. |
public int | next() Returns the index of the next instruction
(not the operand following the current opcode). |
static int | nextOpcode(byte[] code, int index) Calculates the index of the next opcode. |
public int | s16bitAt(int index) Returns the signed 16bit value at the given index. |
public int | s32bitAt(int index) Returns the signed 32bit value at the given index. |
public int | skipConstructor() Moves to the instruction for
either super() or this() . |
public int | skipSuperConstructor() Moves to the instruction for super() . |
public int | skipThisConstructor() Moves to the instruction for this() . |
public int | u16bitAt(int index) Returns the unsigned 16bit value at the given index. |
protected void | updateCursors(int pos, int length) Is called when a gap is inserted. |
public void | write(byte[] code, int index) Writes a byte array at the index. |
public void | write16bit(int value, int index) Writes a 16 bit integer at the index. |
public void | write32bit(int value, int index) Writes a 32bit integer at the index. |
public void | writeByte(int value, int index) Writes an 8bit value at the given index. |