Package org.apache.bcel.generic
Class CPInstruction
java.lang.Object
org.apache.bcel.generic.Instruction
org.apache.bcel.generic.CPInstruction
- All Implemented Interfaces:
Cloneable,IndexedInstruction,TypedInstruction
- Direct Known Subclasses:
ANEWARRAY,CHECKCAST,FieldOrMethod,INSTANCEOF,LDC,LDC2_W,MULTIANEWARRAY,NameSignatureInstruction,NEW
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intDeprecated.(since 6.0) will be made private; do not access directly, use getter/setterFields inherited from class org.apache.bcel.generic.Instruction
length, opcode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddump(DataOutputStream out) Dump instruction as byte code to stream out.final intgetIndex()getType(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.toString(boolean verbose) Long output format: <name of opcode> "["<opcode number>"]" "("<length of instruction>")" "<"< constant pool index>">"toString(ConstantPool cp) Methods inherited from class org.apache.bcel.generic.Instruction
accept, consumeStack, copy, equals, getComparator, getLength, getName, getOpcode, hashCode, isValidByte, isValidShort, produceStack, readInstruction, setComparator, toString
-
Field Details
-
index
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter
-
-
Constructor Details
-
CPInstruction
protected CPInstruction(short opcode, int index) - Parameters:
index- to constant pool
-
-
Method Details
-
dump
Dump instruction as byte code to stream out.- Overrides:
dumpin classInstruction- Parameters:
out- Output stream- Throws:
IOException
-
toString
Long output format: <name of opcode> "["<opcode number>"]" "("<length of instruction>")" "<"< constant pool index>">"- Overrides:
toStringin classInstruction- Parameters:
verbose- long/short format switch- Returns:
- mnemonic for instruction
-
toString
- Overrides:
toStringin classInstruction- Returns:
- mnemonic for instruction with symbolic references resolved
-
initFromFile
Read needed data (i.e., index) from file.- Overrides:
initFromFilein classInstruction- Parameters:
bytes- input streamwide- wide prefix?- Throws:
IOException- may be thrown if the implementation needs to read data from the file
-
getIndex
public final int getIndex()- Specified by:
getIndexin interfaceIndexedInstruction- Returns:
- index in constant pool referred by this instruction.
-
setIndex
public void setIndex(int index) Set the index to constant pool.- Specified by:
setIndexin interfaceIndexedInstruction- Parameters:
index- in constant pool.
-
getType
- Specified by:
getTypein interfaceTypedInstruction- Returns:
- type related with this instruction.
-