ej-technologies

org.gjt.jclasslib.bytecode
Class BranchInstruction

java.lang.Object
  extended byorg.gjt.jclasslib.bytecode.AbstractInstruction
      extended byorg.gjt.jclasslib.bytecode.BranchInstruction
All Implemented Interfaces:
Opcodes

public class BranchInstruction
extends AbstractInstruction

Describes an instruction that branches to a different offset.

Version:
$Revision: 1.5 $ $Date: 2003/08/18 07:58:35 $
Author:
Ingo Kegel

Field Summary
 
Fields inherited from interface org.gjt.jclasslib.bytecode.Opcodes
NEWARRAY_T_BOOLEAN, NEWARRAY_T_BYTE, NEWARRAY_T_CHAR, NEWARRAY_T_DOUBLE, NEWARRAY_T_FLOAT, NEWARRAY_T_INT, NEWARRAY_T_LONG, NEWARRAY_T_SHORT, OPCODE_AALOAD, OPCODE_AASTORE, OPCODE_ACONST_NULL, OPCODE_ALOAD, OPCODE_ALOAD_0, OPCODE_ALOAD_1, OPCODE_ALOAD_2, OPCODE_ALOAD_3, OPCODE_ANEWARRAY, OPCODE_ARETURN, OPCODE_ARRAYLENGTH, OPCODE_ASTORE, OPCODE_ASTORE_0, OPCODE_ASTORE_1, OPCODE_ASTORE_2, OPCODE_ASTORE_3, OPCODE_ATHROW, OPCODE_BALOAD, OPCODE_BASTORE, OPCODE_BIPUSH, OPCODE_BREAKPOINT, OPCODE_CALOAD, OPCODE_CASTORE, OPCODE_CHECKCAST, OPCODE_D2F, OPCODE_D2I, OPCODE_D2L, OPCODE_DADD, OPCODE_DALOAD, OPCODE_DASTORE, OPCODE_DCMPG, OPCODE_DCMPL, OPCODE_DCONST_0, OPCODE_DCONST_1, OPCODE_DDIV, OPCODE_DLOAD, OPCODE_DLOAD_0, OPCODE_DLOAD_1, OPCODE_DLOAD_2, OPCODE_DLOAD_3, OPCODE_DMUL, OPCODE_DNEG, OPCODE_DREM, OPCODE_DRETURN, OPCODE_DSTORE, OPCODE_DSTORE_0, OPCODE_DSTORE_1, OPCODE_DSTORE_2, OPCODE_DSTORE_3, OPCODE_DSUB, OPCODE_DUP, OPCODE_DUP_X1, OPCODE_DUP_X2, OPCODE_DUP2, OPCODE_DUP2_X1, OPCODE_DUP2_X2, OPCODE_F2D, OPCODE_F2I, OPCODE_F2L, OPCODE_FADD, OPCODE_FALOAD, OPCODE_FASTORE, OPCODE_FCMPG, OPCODE_FCMPL, OPCODE_FCONST_0, OPCODE_FCONST_1, OPCODE_FCONST_2, OPCODE_FDIV, OPCODE_FLOAD, OPCODE_FLOAD_0, OPCODE_FLOAD_1, OPCODE_FLOAD_2, OPCODE_FLOAD_3, OPCODE_FMUL, OPCODE_FNEG, OPCODE_FREM, OPCODE_FRETURN, OPCODE_FSTORE, OPCODE_FSTORE_0, OPCODE_FSTORE_1, OPCODE_FSTORE_2, OPCODE_FSTORE_3, OPCODE_FSUB, OPCODE_GETFIELD, OPCODE_GETSTATIC, OPCODE_GOTO, OPCODE_GOTO_W, OPCODE_I2B, OPCODE_I2C, OPCODE_I2D, OPCODE_I2F, OPCODE_I2L, OPCODE_I2S, OPCODE_IADD, OPCODE_IALOAD, OPCODE_IAND, OPCODE_IASTORE, OPCODE_ICONST_0, OPCODE_ICONST_1, OPCODE_ICONST_2, OPCODE_ICONST_3, OPCODE_ICONST_4, OPCODE_ICONST_5, OPCODE_ICONST_M1, OPCODE_IDIV, OPCODE_IF_ACMPEQ, OPCODE_IF_ACMPNE, OPCODE_IF_ICMPEQ, OPCODE_IF_ICMPGE, OPCODE_IF_ICMPGT, OPCODE_IF_ICMPLE, OPCODE_IF_ICMPLT, OPCODE_IF_ICMPNE, OPCODE_IFEQ, OPCODE_IFGE, OPCODE_IFGT, OPCODE_IFLE, OPCODE_IFLT, OPCODE_IFNE, OPCODE_IFNONNULL, OPCODE_IFNULL, OPCODE_IINC, OPCODE_ILOAD, OPCODE_ILOAD_0, OPCODE_ILOAD_1, OPCODE_ILOAD_2, OPCODE_ILOAD_3, OPCODE_IMPDEP1, OPCODE_IMPDEP2, OPCODE_IMUL, OPCODE_INEG, OPCODE_INSTANCEOF, OPCODE_INVOKEINTERFACE, OPCODE_INVOKESPECIAL, OPCODE_INVOKESTATIC, OPCODE_INVOKEVIRTUAL, OPCODE_IOR, OPCODE_IREM, OPCODE_IRETURN, OPCODE_ISHL, OPCODE_ISHR, OPCODE_ISTORE, OPCODE_ISTORE_0, OPCODE_ISTORE_1, OPCODE_ISTORE_2, OPCODE_ISTORE_3, OPCODE_ISUB, OPCODE_IUSHR, OPCODE_IXOR, OPCODE_JSR, OPCODE_JSR_W, OPCODE_L2D, OPCODE_L2F, OPCODE_L2I, OPCODE_LADD, OPCODE_LALOAD, OPCODE_LAND, OPCODE_LASTORE, OPCODE_LCMP, OPCODE_LCONST_0, OPCODE_LCONST_1, OPCODE_LDC, OPCODE_LDC_W, OPCODE_LDC2_W, OPCODE_LDIV, OPCODE_LLOAD, OPCODE_LLOAD_0, OPCODE_LLOAD_1, OPCODE_LLOAD_2, OPCODE_LLOAD_3, OPCODE_LMUL, OPCODE_LNEG, OPCODE_LOOKUPSWITCH, OPCODE_LOR, OPCODE_LREM, OPCODE_LRETURN, OPCODE_LSHL, OPCODE_LSHR, OPCODE_LSTORE, OPCODE_LSTORE_0, OPCODE_LSTORE_1, OPCODE_LSTORE_2, OPCODE_LSTORE_3, OPCODE_LSUB, OPCODE_LUSHR, OPCODE_LXOR, OPCODE_MONITORENTER, OPCODE_MONITOREXIT, OPCODE_MULTIANEWARRAY, OPCODE_NEW, OPCODE_NEWARRAY, OPCODE_NOP, OPCODE_POP, OPCODE_POP2, OPCODE_PUTFIELD, OPCODE_PUTSTATIC, OPCODE_RET, OPCODE_RETURN, OPCODE_SALOAD, OPCODE_SASTORE, OPCODE_SIPUSH, OPCODE_SWAP, OPCODE_TABLESWITCH, OPCODE_WIDE, OPCODE_XXXUNUSEDXXX
 
Constructor Summary
BranchInstruction(int opcode)
          Constructor.
BranchInstruction(int opcode, int branchOffset)
          Constructor.
 
Method Summary
 int getBranchOffset()
          Get the relative offset of the branch of this instruction.
 int getSize()
          Get the size in bytes of this instruction.
 void read(ByteCodeInput in)
          Read this instruction from the given ByteCodeInput.
 void setBranchOffset(int branchOffset)
          Set the relative offset of the branch of this instruction.
 void write(ByteCodeOutput out)
          Write this instruction to the given ByteCodeOutput.
 
Methods inherited from class org.gjt.jclasslib.bytecode.AbstractInstruction
getOffset, getOpcode, getOpcodeVerbose, setOffset, setOpcode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BranchInstruction

public BranchInstruction(int opcode)
Constructor.

Parameters:
opcode - the opcode.

BranchInstruction

public BranchInstruction(int opcode,
                         int branchOffset)
Constructor.

Parameters:
opcode - the opcode.
branchOffset - the branch offset.
Method Detail

getSize

public int getSize()
Description copied from class: AbstractInstruction
Get the size in bytes of this instruction.

Overrides:
getSize in class AbstractInstruction
Returns:
the size in bytes

getBranchOffset

public int getBranchOffset()
Get the relative offset of the branch of this instruction.

Returns:
the offset

setBranchOffset

public void setBranchOffset(int branchOffset)
Set the relative offset of the branch of this instruction.

Parameters:
branchOffset - the offset

read

public void read(ByteCodeInput in)
          throws IOException
Description copied from class: AbstractInstruction
Read this instruction from the given ByteCodeInput.

Excpects ByteCodeInput to be in JVM class file format and just before a instruction of this kind.

Overrides:
read in class AbstractInstruction
Parameters:
in - the ByteCodeInput from which to read
Throws:
IOException - if an exception occurs with the ByteCodeInput

write

public void write(ByteCodeOutput out)
           throws IOException
Description copied from class: AbstractInstruction
Write this instruction to the given ByteCodeOutput.

Overrides:
write in class AbstractInstruction
Parameters:
out - the ByteCodeOutput to which to write
Throws:
IOException - if an exception occurs with the ByteCodeOutput

ej-technologies