org.apache.bcel.generic
public abstract class Instruction extends Object implements Cloneable, Serializable
Field Summary | |
---|---|
protected short | length |
protected short | opcode |
Constructor Summary | |
---|---|
Instruction(short opcode, short length) |
Method Summary | |
---|---|
abstract void | accept(Visitor v)
Call corresponding visitor method(s). |
int | consumeStack(ConstantPoolGen cpg)
This method also gives right results for instructions whose
effect on the stack depends on the constant pool entry they
reference. |
Instruction | copy()
Use with caution, since `BranchInstruction's have a `target' reference which
is not copied correctly (only basic types are). |
void | dump(DataOutputStream out)
Dump instruction as byte code to stream out. |
boolean | equals(Object that) Check for equality, delegated to comparator |
static InstructionComparator | getComparator() Get Comparator object used in the equals() method to determine
equality of instructions.
|
int | getLength() |
String | getName() |
short | getOpcode() |
protected void | initFromFile(ByteSequence bytes, boolean wide)
Read needed data (e.g. index) from file.
|
int | produceStack(ConstantPoolGen cpg)
This method also gives right results for instructions whose
effect on the stack depends on the constant pool entry they
reference. |
static Instruction | readInstruction(ByteSequence bytes)
Read an instruction from (byte code) input stream and return the
appropiate object.
|
static void | setComparator(InstructionComparator c) Set comparator to be used for equals(). |
String | toString(boolean verbose)
Long output format:
<name of opcode> "["<opcode number>"]"
"("<length of instruction>")"
|
String | toString() |
String | toString(ConstantPool cp) |
Parameters: v Visitor object
Returns: Number of words consumed from stack by this instruction, or Constants.UNPREDICTABLE, if this can not be computed statically
Returns: (shallow) copy of an instruction
See Also: BranchInstruction
Parameters: out Output stream
Returns: true if that is an Instruction and has the same opcode
Returns: currently used comparator for equals()
Returns: length (in bytes) of instruction
Returns: name of instruction, i.e., opcode name
Returns: this instructions opcode
Parameters: bytes byte sequence to read from wide "wide" instruction flag
Returns: Number of words produced onto stack by this instruction, or Constants.UNPREDICTABLE, if this can not be computed statically
Parameters: bytes input stream bytes
Returns: instruction object being read
Parameters: verbose long/short format switch
Returns: mnemonic for instruction
Returns: mnemonic for instruction in verbose format
Returns: mnemonic for instruction with sumbolic references resolved