Top Description Fields Constructors Methods
org.apache.bcel.generic

public abstract Class LocalVariableInstruction

extends Instruction
implements TypedInstruction, IndexedInstruction
Class Inheritance
All Implemented Interfaces
org.apache.bcel.generic.IndexedInstruction, org.apache.bcel.generic.TypedInstruction
Known Direct Subclasses
org.apache.bcel.generic.StoreInstruction, org.apache.bcel.generic.IINC, org.apache.bcel.generic.LoadInstruction
Imports
java.io.DataOutputStream, .IOException, org.apache.bcel.Const, org.apache.bcel.util.ByteSequence

Abstract super class for instructions dealing with local variables.

Field Summary

Modifier and TypeField and Description
private short
private short
protected int
n

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

Constructor Summary

AccessConstructor and Description
pack-priv
LocalVariableInstruction()

Empty constructor needed for Instruction.readInstruction.

pack-priv
LocalVariableInstruction(final short canonTag, final short cTag)

Empty constructor needed for Instruction.readInstruction.

protected
LocalVariableInstruction(final short
Instruction opcode
opcode
,
final short
Instruction number for compact version, ALOAD_0, e.g.
cTag
,
final int
local variable index (unsigned short)
n
)

Method Summary

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

Overrides org.apache.bcel.generic.Instruction.dump.

Dump instruction as byte code to stream out.
public short

Returns:

canonical tag for instruction, e.g., ALOAD for ALOAD_0
getCanonicalTag
()

public final int

Returns:

local variable index (n) referred by this instruction.
getIndex
()

Implements org.apache.bcel.generic.IndexedInstruction.getIndex.

public Type

Returns:

type associated with the instruction
getType
(final ConstantPoolGen cp)

Implements org.apache.bcel.generic.TypedInstruction.getType.

Returns the type associated with the instruction - in case of ALOAD or ASTORE Type.OBJECT is returned.
protected void
initFromFile(final ByteSequence
byte sequence to read from
bytes
,
final boolean
"wide" instruction flag
wide
)

Overrides org.apache.bcel.generic.Instruction.initFromFile.

Read needed data (e.g. index) from file.
public void
setIndex(final int n)

Implements org.apache.bcel.generic.IndexedInstruction.setIndex.

Sets the local variable index.
pack-priv final void
setIndexOnly(final int n)

Sets the index of the referenced variable (n) only

public String

Returns:

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

Overrides org.apache.bcel.generic.Instruction.toString.

Long output format: <name of opcode> "["<opcode number>"]" "("<length of instruction>")" "<"< local variable index>">"
private boolean
wide()

Inherited from org.apache.bcel.generic.Instruction:
acceptconsumeStackcopydisposeequalsgetComparatorgetLengthgetNamegetOpcodehashCodeisValidByteisValidShortproduceStackreadInstructionsetComparatorsetLengthsetOpcodetoStringtoString

Field Detail

canonTagback to summary
private short canonTag
cTagback to summary
private short cTag
nback to summary
protected int n

Deprecated

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

Annotations
@Deprecated

Constructor Detail

LocalVariableInstructionback to summary
pack-priv LocalVariableInstruction()

Empty constructor needed for Instruction.readInstruction. Also used by IINC()!

LocalVariableInstructionback to summary
pack-priv LocalVariableInstruction(final short canonTag, final short cTag)

Empty constructor needed for Instruction.readInstruction. Not to be used otherwise. tag and length are defined in readInstruction and initFromFile, respectively.

LocalVariableInstructionback to summary
protected LocalVariableInstruction(final short opcode, final short cTag, final int n)
Parameters
opcode:short

Instruction opcode

cTag:short

Instruction number for compact version, ALOAD_0, e.g.

n:int

local variable index (unsigned short)

Method Detail

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

Overrides org.apache.bcel.generic.Instruction.dump.

Dump instruction as byte code to stream out.

Parameters
out:DataOutputStream

Output stream

Annotations
@Override
Exceptions
IOException:

Doc from org.apache.bcel.generic.Instruction.dump.

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

getCanonicalTagback to summary
public short getCanonicalTag()
Returns:short

canonical tag for instruction, e.g., ALOAD for ALOAD_0

getIndexback to summary
public final int getIndex()

Implements org.apache.bcel.generic.IndexedInstruction.getIndex.

Returns:int

local variable index (n) referred by this instruction.

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

Implements org.apache.bcel.generic.TypedInstruction.getType.

Returns the type associated with the instruction - in case of ALOAD or ASTORE Type.OBJECT is returned. This is just a bit incorrect, because ALOAD and ASTORE may work on every ReferenceType (including Type.NULL) and ASTORE may even work on a ReturnaddressType .

Returns:Type

type associated with the instruction

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

Overrides org.apache.bcel.generic.Instruction.initFromFile.

Read needed data (e.g. index) from file.

(ILOAD <= tag <= ALOAD_3) || (ISTORE <= tag <= ASTORE_3)
Parameters
bytes:ByteSequence

Doc from org.apache.bcel.generic.Instruction.initFromFile.

byte sequence to read from

wide:boolean

Doc from org.apache.bcel.generic.Instruction.initFromFile.

"wide" instruction flag

Annotations
@Override
Exceptions
IOException:

Doc from org.apache.bcel.generic.Instruction.initFromFile.

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

setIndexback to summary
public void setIndex(final int n)

Implements org.apache.bcel.generic.IndexedInstruction.setIndex.

Sets the local variable index. also updates opcode and length TODO Why?

Annotations
@Override
See Also
setIndexOnly(int)
setIndexOnlyback to summary
pack-priv final void setIndexOnly(final int n)

Sets the index of the referenced variable (n) only

Since
6.0
See Also
setIndex(int)
toStringback to summary
public String toString(final boolean verbose)

Overrides org.apache.bcel.generic.Instruction.toString.

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

Parameters
verbose:boolean

long/short format switch

Returns:String

mnemonic for instruction

Annotations
@Override
wideback to summary
private boolean wide()