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

public Class LocalVariableTable

extends Attribute
implements Iterable<LocalVariable>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable
Imports
java.io.DataInput, .DataOutputStream, .IOException, java.util.Arrays, .Iterator, java.util.stream.Stream, org.apache.bcel.Const, org.apache.bcel.util.Args

This class represents colection of local variables in a method. This attribute is contained in the Code attribute.
See Also
Code, LocalVariable

Field Summary

Modifier and TypeField and Description
private LocalVariable[]
localVariableTable

Deprecated as a consequence of LocalVariable being deprecated.
Inherited from org.apache.bcel.classfile.Attribute:
constant_poolEMPTY_ARRAYlengthname_indextag

Constructor Summary

AccessConstructor and Description
pack-priv
LocalVariableTable(final int
Index in constant pool
nameIndex
,
final int
Content length in bytes
length
,
final DataInput
Input stream
input
,
final ConstantPool
Array of constants
constantPool
)

Constructs object from input stream.

public
LocalVariableTable(final int
Index in constant pool to 'LocalVariableTable'
nameIndex
,
final int
Content length in bytes
length
,
final LocalVariable[]
Table of local variables
localVariableTable
,
final ConstantPool
Array of constants
constantPool
)

Deprecated as a consequence of LocalVariable being deprecated.
public
LocalVariableTable(final LocalVariableTable
Source to copy.
c
)

Initialize from another object.

Method Summary

Modifier and TypeMethod and Description
public void
accept(final Visitor
Visitor object
v
)

Implements abstract org.apache.bcel.classfile.Attribute.accept.

Implements org.apache.bcel.classfile.Node.accept.

Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.
public Attribute

Returns:

deep copy of this attribute
copy
(final ConstantPool
constant pool to save.
constantPool
)

Implements abstract org.apache.bcel.classfile.Attribute.copy.

public final void
dump(final DataOutputStream
Output file stream
file
)

Overrides org.apache.bcel.classfile.Attribute.dump.

Dump local variable table attribute to file stream in binary format.
public final LocalVariable

Returns:

the first LocalVariable that matches the slot or null if not found
getLocalVariable
(final int
the variable slot
index
)

Deprecated since 5.2 because multiple variables can share the same slot, use getLocalVariable(int index, int pc) instead.
public final LocalVariable

Returns:

the LocalVariable that matches or null if not found
getLocalVariable
(final int
the variable slot
index
,
final int
the current pc that this variable is alive
pc
)

Deprecated as a consequence of LocalVariable being deprecated.
public final LocalVariable[]

Returns:

Array of local variables of method.
getLocalVariableTable
()

Deprecated as a consequence of LocalVariable being deprecated.
public final int
public Iterator<LocalVariable>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.
public final void
setLocalVariableTable(final LocalVariable[] localVariableTable)

Deprecated as a consequence of LocalVariable being deprecated.
public final String

Returns:

String representation.
toString
()

Overrides org.apache.bcel.classfile.Attribute.toString.

Returns a string representation of the object.
Inherited from org.apache.bcel.classfile.Attribute:
addAttributeReaderaddAttributeReaderclonegetConstantPoolgetLengthgetNamegetNameIndexgetTagprintlnreadAttributereadAttributeremoveAttributeReadersetConstantPoolsetLengthsetNameIndex

Field Detail

localVariableTableback to summary
private LocalVariable[] localVariableTable

Deprecated

as a consequence of LocalVariable being deprecated. See corresponding docs for further information.

Constructor Detail

LocalVariableTableback to summary
pack-priv LocalVariableTable(final int nameIndex, final int length, final DataInput input, final ConstantPool constantPool) throws IOException

Constructs object from input stream.

Parameters
nameIndex:int

Index in constant pool

length:int

Content length in bytes

input:DataInput

Input stream

constantPool:ConstantPool

Array of constants

Exceptions
IOException:
if an I/O error occurs.
LocalVariableTableback to summary
public LocalVariableTable(final int nameIndex, final int length, final LocalVariable[] localVariableTable, final ConstantPool constantPool)

Deprecated

as a consequence of LocalVariable being deprecated. See corresponding docs for further information.

Parameters
nameIndex:int

Index in constant pool to 'LocalVariableTable'

length:int

Content length in bytes

localVariableTable:LocalVariable[]

Table of local variables

constantPool:ConstantPool

Array of constants

LocalVariableTableback to summary
public LocalVariableTable(final LocalVariableTable c)

Initialize from another object. Note that both objects use the same references (shallow copy). Use copy() for a physical copy.

Parameters
c:LocalVariableTable

Source to copy.

Method Detail

acceptback to summary
public void accept(final Visitor v)

Implements abstract org.apache.bcel.classfile.Attribute.accept.

Implements org.apache.bcel.classfile.Node.accept.

Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.

Parameters
v:Visitor

Visitor object

Annotations
@Override
copyback to summary
public Attribute copy(final ConstantPool constantPool)

Implements abstract org.apache.bcel.classfile.Attribute.copy.

Parameters
constantPool:ConstantPool

Doc from org.apache.bcel.classfile.Attribute.copy.

constant pool to save.

Returns:Attribute

deep copy of this attribute

Annotations
@Override
dumpback to summary
public final void dump(final DataOutputStream file) throws IOException

Overrides org.apache.bcel.classfile.Attribute.dump.

Dump local variable table attribute to file stream in binary format.

Parameters
file:DataOutputStream

Output file stream

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
getLocalVariableback to summary
public final LocalVariable getLocalVariable(final int index)

Deprecated

since 5.2 because multiple variables can share the same slot, use getLocalVariable(int index, int pc) instead.

Parameters
index:int

the variable slot

Returns:LocalVariable

the first LocalVariable that matches the slot or null if not found

Annotations
@Deprecated
getLocalVariableback to summary
public final LocalVariable getLocalVariable(final int index, final int pc)

Deprecated

as a consequence of LocalVariable being deprecated. See corresponding docs for further information.

Parameters
index:int

the variable slot

pc:int

the current pc that this variable is alive

Returns:LocalVariable

the LocalVariable that matches or null if not found

getLocalVariableTableback to summary
public final LocalVariable[] getLocalVariableTable()

Deprecated

as a consequence of LocalVariable being deprecated. See corresponding docs for further information.

Returns:LocalVariable[]

Array of local variables of method.

getTableLengthback to summary
public final int getTableLength()
iteratorback to summary
public Iterator<LocalVariable> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<LocalVariable>

an Iterator.

Annotations
@Override
setLocalVariableTableback to summary
public final void setLocalVariableTable(final LocalVariable[] localVariableTable)

Deprecated

as a consequence of LocalVariable being deprecated. See corresponding docs for further information.

toStringback to summary
public final String toString()

Overrides org.apache.bcel.classfile.Attribute.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

String representation.

Annotations
@Override