APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.bcel.internal.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, com.sun.org.apache.bcel.internal.Const, com.sun.org.apache.bcel.internal.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 static final LocalVariable[]
private LocalVariable[]
Inherited from com.sun.org.apache.bcel.internal.classfile.Attribute:
constant_poollengthname_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
)

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 com.sun.org.apache.bcel.internal.classfile.Attribute.accept.

Implements com.sun.org.apache.bcel.internal.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
copy(final ConstantPool constantPool)

Implements abstract com.sun.org.apache.bcel.internal.classfile.Attribute.copy.

Returns: deep copy of this attribute

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

Overrides com.sun.org.apache.bcel.internal.classfile.Attribute.dump.

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

public final LocalVariable
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.

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

public final LocalVariable
getLocalVariable(final int
the variable slot
index
,
final int
the current pc that this variable is alive
pc
)

Returns: the LocalVariable that matches or null if not found

public final LocalVariable[]
getLocalVariableTable()

Returns: Array of local variables of method.

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)

public final String

Returns:

String representation.
toString
()

Overrides com.sun.org.apache.bcel.internal.classfile.Attribute.toString.

Returns a string representation of the object.

Inherited from com.sun.org.apache.bcel.internal.classfile.Attribute:
addAttributeReaderclonegetConstantPoolgetLengthgetNamegetNameIndexgetTagprintlnreadAttributereadAttributeremoveAttributeReadersetConstantPoolsetLengthsetNameIndex

Field Detail

EMPTY_ARRAYback to summary
private static final LocalVariable[] EMPTY_ARRAY

Hides com.sun.org.apache.bcel.internal.classfile.Attribute.EMPTY_ARRAY.

localVariableTableback to summary
private LocalVariable[] localVariableTable

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)
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 com.sun.org.apache.bcel.internal.classfile.Attribute.accept.

Implements com.sun.org.apache.bcel.internal.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 com.sun.org.apache.bcel.internal.classfile.Attribute.copy.

Returns:Attribute

deep copy of this attribute

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

Overrides com.sun.org.apache.bcel.internal.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)
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()
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.

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

Overrides com.sun.org.apache.bcel.internal.classfile.Attribute.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

String representation.

Annotations
@Override