Class MultiANewArrayInstruction


  • public class MultiANewArrayInstruction
    extends Instruction
    Represents the MULTIANEWARRAY instruction (0xC5).
    • Constructor Detail

      • MultiANewArrayInstruction

        public MultiANewArrayInstruction​(ConstPool constPool,
                                         int opcode,
                                         int offset,
                                         int classIndex,
                                         int dimensions)
        Constructs a MultiANewArrayInstruction.
        Parameters:
        constPool - The constant pool associated with the class.
        opcode - The opcode of the instruction.
        offset - The bytecode offset of the instruction.
        classIndex - The constant pool index for the class reference.
        dimensions - The number of dimensions for the new array.
    • Method Detail

      • getClassIndex

        public int getClassIndex()
        Returns:
        the class index
      • getDimensions

        public int getDimensions()
        Returns:
        the dimensions
      • write

        public void write​(DataOutputStream dos)
                   throws IOException
        Writes the MULTIANEWARRAY 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 dimensions count from stack, pushes array reference).
      • 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).
      • resolveClass

        public String resolveClass()
        Resolves and returns a string representation of the array class.
        Returns:
        The array class as a string.
      • toString

        public String toString()
        Returns a string representation of the instruction.
        Overrides:
        toString in class Instruction
        Returns:
        The mnemonic, class index, dimensions, and resolved class.