Class InstructionLength


  • public final class InstructionLength
    extends Object
    Encoded length of a single instruction in a raw bytecode array, for scanners that walk code without parsing it into instruction objects.
    • Method Detail

      • at

        public static int at​(byte[] code,
                             int offset)
        The encoded length of the instruction at an offset, including its opcode byte. All fixed-length instructions derive from Opcode.getOperandCount(), so the only cases spelled out here are the three whose length depends on the code around them.
        Parameters:
        code - the raw bytecode
        offset - the offset of the instruction's opcode byte
        Returns:
        the length in bytes, or -1 if the instruction is truncated or malformed