org.apache.bcel.generic

Class CPInstruction

public abstract class CPInstruction extends Instruction implements TypedInstruction, IndexedInstruction

Abstract super class for instructions that use an index into the constant pool such as LDC, INVOKEVIRTUAL, etc.

See Also: ConstantPoolGen LDC

Field Summary
protected intindex
Constructor Summary
protected CPInstruction(short opcode, int index)
Method Summary
voiddump(DataOutputStream out)
Dump instruction as byte code to stream out.
intgetIndex()
TypegetType(ConstantPoolGen cpg)
protected voidinitFromFile(ByteSequence bytes, boolean wide)
Read needed data (i.e., index) from file.
voidsetIndex(int index)
Set the index to constant pool.
StringtoString(boolean verbose)
Long output format: <name of opcode> "["<opcode number>"]" "("<length of instruction>")" "<"< constant pool index>">"
StringtoString(ConstantPool cp)

Field Detail

index

protected int index

Constructor Detail

CPInstruction

protected CPInstruction(short opcode, int index)

Parameters: index to constant pool

Method Detail

dump

public void dump(DataOutputStream out)
Dump instruction as byte code to stream out.

Parameters: out Output stream

getIndex

public final int getIndex()

Returns: index in constant pool referred by this instruction.

getType

public Type getType(ConstantPoolGen cpg)

Returns: type related with this instruction.

initFromFile

protected void initFromFile(ByteSequence bytes, boolean wide)
Read needed data (i.e., index) from file.

Parameters: bytes input stream wide wide prefix?

setIndex

public void setIndex(int index)
Set the index to constant pool.

Parameters: index in constant pool.

toString

public String toString(boolean verbose)
Long output format: <name of opcode> "["<opcode number>"]" "("<length of instruction>")" "<"< constant pool index>">"

Parameters: verbose long/short format switch

Returns: mnemonic for instruction

toString

public String toString(ConstantPool cp)

Returns: mnemonic for instruction with symbolic references resolved