Top Description Fields Constructors Methods
com.sun.org.apache.bcel.internal.generic

public abstract Class CPInstruction

extends Instruction
implements TypedInstruction, IndexedInstruction
Class Inheritance
All Implemented Interfaces
com.sun.org.apache.bcel.internal.generic.IndexedInstruction, com.sun.org.apache.bcel.internal.generic.TypedInstruction
Known Direct Subclasses
com.sun.org.apache.bcel.internal.generic.FieldOrMethod, com.sun.org.apache.bcel.internal.generic.INSTANCEOF, com.sun.org.apache.bcel.internal.generic.LDC, com.sun.org.apache.bcel.internal.generic.LDC2_W, com.sun.org.apache.bcel.internal.generic.MULTIANEWARRAY, com.sun.org.apache.bcel.internal.generic.NameSignatureInstruction, com.sun.org.apache.bcel.internal.generic.NEW, com.sun.org.apache.bcel.internal.generic.ANEWARRAY, com.sun.org.apache.bcel.internal.generic.CHECKCAST
Imports
java.io.DataOutputStream, .IOException, com.sun.org.apache.bcel.internal.classfile.Constant, .ConstantClass, .ConstantPool, .Utility, com.sun.org.apache.bcel.internal.util.ByteSequence

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

Field Summary

Modifier and TypeField and Description
protected int
index

Deprecated (since 6.0) will be made private; do not access directly, use getter/setter
Inherited from com.sun.org.apache.bcel.internal.generic.Instruction:
EMPTY_ARRAYlengthopcode

Constructor Summary

AccessConstructor and Description
pack-priv
CPInstruction()

Empty constructor needed for Instruction.readInstruction.

protected
CPInstruction(final short opcode, final int
to constant pool
index
)

Method Summary

Modifier and TypeMethod and Description
public void
dump(final DataOutputStream
Output stream
out
)

Overrides com.sun.org.apache.bcel.internal.generic.Instruction.dump.

Dump instruction as byte code to stream out.
public final int

Returns:

index in constant pool referred by this instruction.
getIndex
()

Implements com.sun.org.apache.bcel.internal.generic.IndexedInstruction.getIndex.

public Type

Returns:

type related with this instruction.
getType
(final ConstantPoolGen cpg)

Implements com.sun.org.apache.bcel.internal.generic.TypedInstruction.getType.

protected void
initFromFile(final ByteSequence
input stream
bytes
,
final boolean
wide prefix?
wide
)

Overrides com.sun.org.apache.bcel.internal.generic.Instruction.initFromFile.

Read needed data (i.e., index) from file.
public void
setIndex(final int
in constant pool.
index
)

Implements com.sun.org.apache.bcel.internal.generic.IndexedInstruction.setIndex.

Set the index to constant pool.
public String

Returns:

mnemonic for instruction
toString
(final boolean
long/short format switch
verbose
)

Overrides com.sun.org.apache.bcel.internal.generic.Instruction.toString.

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

Returns:

mnemonic for instruction with symbolic references resolved
toString
(final ConstantPool cp)

Overrides com.sun.org.apache.bcel.internal.generic.Instruction.toString.

Inherited from com.sun.org.apache.bcel.internal.generic.Instruction:
acceptconsumeStackcopydisposeequalsgetComparatorgetLengthgetNamegetOpcodehashCodeisValidByteisValidShortproduceStackreadInstructionsetComparatorsetLengthsetOpcodetoString

Field Detail

indexback to summary
protected int index

Deprecated

(since 6.0) will be made private; do not access directly, use getter/setter

Annotations
@Deprecated

Constructor Detail

CPInstructionback to summary
pack-priv CPInstruction()

Empty constructor needed for Instruction.readInstruction. Not to be used otherwise.

CPInstructionback to summary
protected CPInstruction(final short opcode, final int index)
Parameters
index:int

to constant pool

Method Detail

dumpback to summary
public void dump(final DataOutputStream out) throws IOException

Overrides com.sun.org.apache.bcel.internal.generic.Instruction.dump.

Dump instruction as byte code to stream out.

Parameters
out:DataOutputStream

Output stream

Annotations
@Override
Exceptions
IOException:

Doc from com.sun.org.apache.bcel.internal.generic.Instruction.dump.

Thrown when an I/O exception of some sort has occurred.

getIndexback to summary
public final int getIndex()

Implements com.sun.org.apache.bcel.internal.generic.IndexedInstruction.getIndex.

Returns:int

index in constant pool referred by this instruction.

Annotations
@Override
getTypeback to summary
public Type getType(final ConstantPoolGen cpg)

Implements com.sun.org.apache.bcel.internal.generic.TypedInstruction.getType.

Returns:Type

type related with this instruction.

Annotations
@Override
initFromFileback to summary
protected void initFromFile(final ByteSequence bytes, final boolean wide) throws IOException

Overrides com.sun.org.apache.bcel.internal.generic.Instruction.initFromFile.

Read needed data (i.e., index) from file.

Parameters
bytes:ByteSequence

input stream

wide:boolean

wide prefix?

Annotations
@Override
Exceptions
IOException:

Doc from com.sun.org.apache.bcel.internal.generic.Instruction.initFromFile.

may be thrown if the implementation needs to read data from the file

setIndexback to summary
public void setIndex(final int index)

Implements com.sun.org.apache.bcel.internal.generic.IndexedInstruction.setIndex.

Set the index to constant pool.

Parameters
index:int

in constant pool.

Annotations
@Override
toStringback to summary
public String toString(final boolean verbose)

Overrides com.sun.org.apache.bcel.internal.generic.Instruction.toString.

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

Parameters
verbose:boolean

long/short format switch

Returns:String

mnemonic for instruction

Annotations
@Override
toStringback to summary
public String toString(final ConstantPool cp)

Overrides com.sun.org.apache.bcel.internal.generic.Instruction.toString.

Returns:String

mnemonic for instruction with symbolic references resolved

Annotations
@Override