org.apache.bcel.generic
Class CPInstruction
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,v 1.1.1.1 2001/10/29 20:00:07 jvanzyl Exp $
- Author:
- M. Dahm
- See Also:
- ConstantPoolGen,- LDC,- INVOKEVIRTUAL, 
Serialized Form
| Field Summary | 
| protected  int | index
 | 
 
 
| Constructor Summary | 
| protected  | CPInstruction(short opcode,
              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., index) from file.
 | 
|  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 org.apache.bcel.generic.Instruction | 
| accept, consumeStack, copy, equals, getComparator, getLength, getName, getOpcode, produceStack, readInstruction, setComparator, toString | 
 
| Methods inherited from class java.lang.Object | 
| clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
 
index
protected int index
CPInstruction
protected CPInstruction(short opcode,
                        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.
 
- 
- Overrides:
- dumpin class- Instruction
 
- 
- Parameters:
- out- Output stream
- java.io.IOException
 
toString
public java.lang.String toString(boolean verbose)
- Long output format:
 <name of opcode> "["<opcode number>"]" 
 "("<length of instruction>")" "<"< constant pool index>">"
 
- 
- Overrides:
- toStringin class- Instruction
 
- 
- Parameters:
- verbose- long/short format switch
- Returns:
- mnemonic for instruction
 
toString
public java.lang.String toString(ConstantPool cp)
- 
- Overrides:
- toStringin class- Instruction
 
- 
- Returns:
- mnemonic for instruction with symbolic references resolved
 
initFromFile
protected void initFromFile(ByteSequence bytes,
                            boolean wide)
                     throws java.io.IOException
- Read needed data (i.e., index) from file.
 
- 
- Overrides:
- initFromFilein class- Instruction
 
- 
- Parameters:
- bytes- input stream
- wide- wide prefix?
- java.io.IOException
 
getIndex
public final int getIndex()
- 
- Specified by:
- getIndexin interface- IndexedInstruction
 
- 
- Returns:
- index in constant pool referred by this instruction.
 
setIndex
public void setIndex(int index)
- Set the index to constant pool.
 
- 
- Specified by:
- setIndexin interface- IndexedInstruction
 
- 
- Parameters:
- index- in  constant pool.
 
getType
public Type getType(ConstantPoolGen cpg)
- 
- Specified by:
- getTypein interface- TypedInstruction
 
- 
- Returns:
- type related with this instruction.
 
Copyright © 2002-2003 Apache Software Foundation. All Rights Reserved.