Package com.tonic.util
Class InstructionLength
- java.lang.Object
-
- com.tonic.util.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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intat(byte[] code, int offset)The encoded length of the instruction at an offset, including its opcode byte.
-
-
-
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 fromOpcode.getOperandCount(), so the only cases spelled out here are the three whose length depends on the code around them.- Parameters:
code- the raw bytecodeoffset- the offset of the instruction's opcode byte- Returns:
- the length in bytes, or -1 if the instruction is truncated or malformed
-
-