de.fub.bytecode.generic
Class CPInstruction
java.lang.Object
|
+--de.fub.bytecode.generic.Instruction
|
+--de.fub.bytecode.generic.CPInstruction
- Direct Known Subclasses:
- ANEWARRAY, CHECKCAST, FieldOrMethod, INSTANCEOF, LDC, LDC2_W, MULTIANEWARRAY, NEW
- public abstract class CPInstruction
- extends Instruction
- implements Constants
Abstract super class for instructions that use an index into the
constant pool such as LDC, INVOKEVIRTUAL, etc.
- Version:
- $Id: CPInstruction.java,v 1.7 1999/07/09 15:55:07 dahm Exp $
- Author:
- M. Dahm
- See Also:
ConstantPoolGen
,
LDC
,
INVOKEVIRTUAL
, Serialized Form
Field Summary |
protected int |
index
|
Constructor Summary |
protected |
CPInstruction(short tag,
int index)
|
Method Summary |
void |
dump(java.io.DataOutputStream out)
Dump instruction as byte code to stream out. |
int |
getIndex()
|
Type |
getType(ConstantPoolGen cpg)
|
protected void |
initFromFile(ByteSequence bytes,
boolean wide)
Read needed data (i.e. |
void |
setIndex(int index)
Set the index to constant pool. |
java.lang.String |
toString(boolean verbose)
Long output format:
<name of opcode> "["<opcode number>"]"
"("<length of instruction>")" "<"< constant pool index>">" |
java.lang.String |
toString(ConstantPool cp)
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
index
protected int index
CPInstruction
protected CPInstruction(short tag,
int index)
- Parameters:
index
- to constant pool
dump
public void dump(java.io.DataOutputStream out)
throws java.io.IOException
- Dump instruction as byte code to stream out.
- Parameters:
out
- Output stream- 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>">"
- Parameters:
verbose
- long/short format switch- Returns:
- mnemonic for instruction
- Overrides:
- toString in class Instruction
toString
public java.lang.String toString(ConstantPool cp)
- Returns:
- mnemonic for instruction with symbolic references resolved
- Overrides:
- toString in class Instruction
initFromFile
protected void initFromFile(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()
- Returns:
- index in constant pool referred by this instruction.
setIndex
public void setIndex(int index)
- Set the index to constant pool.
getType
public Type getType(ConstantPoolGen cpg)
- Returns:
- type related with this instruction.