Class TableSwitchInstruction


  • public class TableSwitchInstruction
    extends Instruction
    Represents the TABLESWITCH instruction (0xAA).
    • Constructor Detail

      • TableSwitchInstruction

        public TableSwitchInstruction​(int opcode,
                                      int offset,
                                      int padding,
                                      int defaultOffset,
                                      int low,
                                      int high,
                                      Map<Integer,​Integer> jumpOffsets)
        Constructs a TableSwitchInstruction.
        Parameters:
        opcode - The opcode of the instruction.
        offset - The bytecode offset of the instruction.
        padding - The number of padding bytes to align to 4-byte boundary.
        defaultOffset - The branch target offset if no key matches.
        low - The lowest key value.
        high - The highest key value.
        jumpOffsets - The map of key to branch target offsets.
    • Method Detail

      • getPadding

        public int getPadding()
        Returns:
        the padding
      • getDefaultOffset

        public int getDefaultOffset()
        Returns:
        the default offset
      • getLow

        public int getLow()
        Returns:
        the low
      • getHigh

        public int getHigh()
        Returns:
        the high
      • getJumpOffsets

        public Map<Integer,​Integer> getJumpOffsets()
        Returns:
        the jump offsets
      • write

        public void write​(DataOutputStream dos)
                   throws IOException
        Writes the TABLESWITCH opcode and its operands to the DataOutputStream.
        Specified by:
        write in class Instruction
        Parameters:
        dos - The DataOutputStream to write to.
        Throws:
        IOException - If an I/O error occurs.
      • getStackChange

        public int getStackChange()
        Returns the change in stack size caused by this instruction.
        Specified by:
        getStackChange in class Instruction
        Returns:
        The stack size change (pops one int).
      • getLocalChange

        public int getLocalChange()
        Returns the change in local variables caused by this instruction.
        Specified by:
        getLocalChange in class Instruction
        Returns:
        The local variables size change (none).
      • toString

        public String toString()
        Returns a string representation of the instruction.
        Overrides:
        toString in class Instruction
        Returns:
        The mnemonic, default offset, low, high, and jump offsets.