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

public Class LocalVariableTable

extends Attribute
Class Inheritance
Imports
java.io.ByteArrayInputStream, .DataInputStream, .DataOutputStream, .IOException, org.aspectj.apache.bcel.Constants

This class represents collection of local variables in a method. This attribute is contained in the Code attribute.
Author
M. Dahm
Version
$Id: LocalVariableTable.java,v 1.8 2009/09/15 19:40:12 aclement Exp $
See Also
Code, Updates: Andy 14Feb06 - Made unpacking of the data lazy, depending on someone actually asking for it.

Field Summary

Modifier and TypeField and Description
private byte[]
private boolean
private LocalVariable[]
private int
Inherited from org.aspectj.apache.bcel.classfile.Attribute:
cpoollengthnameIndexNoAttributestag

Constructor Summary

AccessConstructor and Description
public
LocalVariableTable(LocalVariableTable c)

Initialize from another object.

public
LocalVariableTable(int
Index in constant pool to `LocalVariableTable'
name_index
,
int
Content length in bytes
length
,
LocalVariable[]
Table of local variables
local_variable_table
,
ConstantPool
Array of constants
constant_pool
)

pack-priv
LocalVariableTable(int
Index in constant pool
name_index
,
int
Content length in bytes
length
,
DataInputStream
Input stream
file
,
ConstantPool
Array of constants
constant_pool
)

Construct object from file stream.

Method Summary

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

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

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

Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class.
public synchronized LocalVariableTable
copyFromPackedState()

Returns copy of this attribute using same packed state.

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

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

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

Returns:

first matching variable using index
getLocalVariable
(int index)

public final LocalVariable[]

Returns:

Array of local variables of method.
getLocalVariableTable
()

public final int

Returns:

deep copy of this attribute
getTableLength
()

public final synchronized void
setLocalVariableTable(LocalVariable[] local_variable_table)

public final String

Returns:

String representation.
toString
()

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

Returns a string representation of the object.
private synchronized void
Inherited from org.aspectj.apache.bcel.classfile.Attribute:
getConstantPoolgetLengthgetNamegetNameIndexgetTagreadAttribute

Field Detail

databack to summary
private byte[] data
isInPackedStateback to summary
private boolean isInPackedState
localVariableTableback to summary
private LocalVariable[] localVariableTable
localVariableTableLengthback to summary
private int localVariableTableLength

Constructor Detail

LocalVariableTableback to summary
public LocalVariableTable(LocalVariableTable c)

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

LocalVariableTableback to summary
public LocalVariableTable(int name_index, int length, LocalVariable[] local_variable_table, ConstantPool constant_pool)
Parameters
name_index:int

Index in constant pool to `LocalVariableTable'

length:int

Content length in bytes

local_variable_table:LocalVariable[]

Table of local variables

constant_pool:ConstantPool

Array of constants

LocalVariableTableback to summary
pack-priv LocalVariableTable(int name_index, int length, DataInputStream file, ConstantPool constant_pool) throws IOException

Construct object from file stream.

Parameters
name_index:int

Index in constant pool

length:int

Content length in bytes

file:DataInputStream

Input stream

constant_pool:ConstantPool

Array of constants

Method Detail

acceptback to summary
public void accept(ClassVisitor v)

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

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

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

Parameters
v:ClassVisitor

Visitor object

Annotations
@Override
copyFromPackedStateback to summary
public synchronized LocalVariableTable copyFromPackedState()

Returns copy of this attribute using same packed state. Used in unit tests.

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

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

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

Parameters
file:DataOutputStream

Output file stream

Annotations
@Override
getLocalVariableback to summary
public final LocalVariable getLocalVariable(int index)
Returns:LocalVariable

first matching variable using index

getLocalVariableTableback to summary
public final LocalVariable[] getLocalVariableTable()
Returns:LocalVariable[]

Array of local variables of method.

getTableLengthback to summary
public final int getTableLength()
Returns:int

deep copy of this attribute

setLocalVariableTableback to summary
public final synchronized void setLocalVariableTable(LocalVariable[] local_variable_table)
toStringback to summary
public final String toString()

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

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

String representation.

Annotations
@Override
unpackback to summary
private synchronized void unpack()