All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class espresso.classfile.classgen.BranchInstruction

java.lang.Object
   |
   +----espresso.classfile.classgen.Instruction
           |
           +----espresso.classfile.classgen.BranchInstruction

public abstract class BranchInstruction
extends Instruction
Abstract super class for branching instructions like GOTO, IFEQ, etc.. Branch instructions may have a variable length, namely GOTO, JSR, LOOKUPSWITCH and TABLESWITCH.

See Also:
InstructionList

Variable Index

 o index
 o target

Constructor Index

 o BranchInstruction()
Empty constructor needed for the Class.newInstance() statement in Instruction.readInstruction().
 o BranchInstruction(short, InstructionHandle)

Method Index

 o dump(DataOutputStream)
Dump instruction as byte code to stream out.
 o getIndex()
 o getTarget()
 o getTargetOffset()
 o getTargetOffset(Instruction)
 o getTargetOffset(InstructionHandle)
 o initFromFile(ByteSequence, boolean)
Read needed data (e.g.
 o setTarget(InstructionHandle)
Set branch target
 o toString()

Variables

 o index
 protected int index
 o target
 protected InstructionHandle target

Constructors

 o BranchInstruction
 BranchInstruction()
Empty constructor needed for the Class.newInstance() statement in Instruction.readInstruction(). Not to be used otherwise.

 o BranchInstruction
 protected BranchInstruction(short tag,
                             InstructionHandle target)
Parameters:
instruction - Target instruction to branch to

Methods

 o dump
 public void dump(DataOutputStream out) throws IOException
Dump instruction as byte code to stream out.

Parameters:
out - Output stream
Overrides:
dump in class Instruction
 o getTarget
 public InstructionHandle getTarget()
Returns:
target of branch instruction
 o setTarget
 public void setTarget(InstructionHandle target)
Set branch target

 o getTargetOffset
 protected int getTargetOffset(Instruction target)
Parameters:
target - branch target
Returns:
the offset to `target' relative to this instruction
 o getTargetOffset
 protected int getTargetOffset(InstructionHandle target)
Parameters:
target - branch target
Returns:
the offset to `target' relative to this instruction
 o getTargetOffset
 protected int getTargetOffset()
Returns:
the offset to this instruction's target
 o toString
 public String toString()
Returns:
mnemonic for instruction
Overrides:
toString in class Instruction
 o initFromFile
 protected void initFromFile(ByteSequence bytes,
                             boolean wide) throws IOException
Read needed data (e.g. index) from file. Conversion to a InstructionHandle is done in InstructionList(byte[]).

Overrides:
initFromFile in class Instruction
See Also:
InstructionList
 o getIndex
 final int getIndex()
Returns:
target offset

All Packages  Class Hierarchy  This Package  Previous  Next  Index