java.lang.Object
org.apache.bcel.generic.Instruction
org.apache.bcel.generic.CPInstruction
- All Implemented Interfaces:
- java.lang.Cloneable, IndexedInstruction, java.io.Serializable, TypedInstruction
- Direct Known Subclasses:
- ANEWARRAY, CHECKCAST, FieldOrMethod, INSTANCEOF, LDC, LDC2_W, MULTIANEWARRAY, 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.
- Version:
- $Id: CPInstruction.java 386056 2006-03-15 11:31:56Z tcurdt $
|
Field Summary |
protected int |
index
|
|
Constructor Summary |
(package private) |
CPInstruction()
Empty constructor needed for the Class.newInstance() statement in
Instruction.readInstruction(). |
protected |
CPInstruction(short opcode,
int index)
|
| Methods inherited from class org.apache.bcel.generic.Instruction |
accept, consumeStack, copy, dispose, equals, getComparator, getLength, getName, getOpcode, produceStack, readInstruction, setComparator, toString |
index
protected int index
CPInstruction
CPInstruction()
- Empty constructor needed for the Class.newInstance() statement in
Instruction.readInstruction(). Not to be used otherwise.
CPInstruction
protected CPInstruction(short opcode,
int index)
dump
public void dump(java.io.DataOutputStream out)
throws java.io.IOException
- Dump instruction as byte code to stream out.
- Overrides:
dump in class Instruction
toString
public java.lang.String toString(boolean verbose)
- Long output format:
<name of opcode> "["<opcode number>"]"
"("<length of instruction>")" "<"< constant pool index>">"
- Overrides:
toString in class Instruction
toString
public java.lang.String toString(org.apache.bcel.classfile.ConstantPool cp)
- Overrides:
toString in class Instruction
initFromFile
protected void initFromFile(org.apache.bcel.util.ByteSequence bytes,
boolean wide)
throws java.io.IOException
- Read needed data (i.e., index) from file.
- Overrides:
initFromFile in class Instruction
getIndex
public final int getIndex()
- Specified by:
getIndex in interface IndexedInstruction
setIndex
public void setIndex(int index)
- Set the index to constant pool.
- Specified by:
setIndex in interface IndexedInstruction
getType
public Type getType(ConstantPoolGen cpg)
- Specified by:
getType in interface TypedInstruction