APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.bcel.internal.classfile

public final Class LineNumberTable

extends Attribute
implements Iterable<LineNumber>
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, jdk.xml.internal.SecuritySupport

This class represents a table of line numbers for debugging purposes. This attribute is used by the Code attribute. It contains pairs of PCs and line numbers.
See Also
Code, LineNumber

Field Summary

Modifier and TypeField and Description
private LineNumber[]
private static final int
Inherited from com.sun.org.apache.bcel.internal.classfile.Attribute:
constant_poolEMPTY_ARRAYlengthname_indextag

Constructor Summary

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

Constructs a new instance from a data input stream.

public
LineNumberTable(final int
Index of name
nameIndex
,
final int
Content length in bytes
length
,
final LineNumber[]
Table of line/numbers pairs
lineNumberTable
,
final ConstantPool
Array of constants
constantPool
)

Constructs a new instance.

public
LineNumberTable(final LineNumberTable c)

Constructs a new instance from another.

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 void
dump(final DataOutputStream
Output file stream
file
)

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

Dump line number table attribute to file stream in binary format.

public LineNumber[]
getLineNumberTable()

Returns: Array of (pc offset, line number) pairs.

public int

Returns:

corresponding line in source code
getSourceLine
(final int
byte code offset
pos
)

Map byte code positions to source code lines.

public int
public Iterator<LineNumber>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

public void
setLineNumberTable(final LineNumber[]
the line number entries for this table
lineNumberTable
)

public 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

lineNumberTableback to summary
private LineNumber[] lineNumberTable
MAX_LINE_LENGTHback to summary
private static final int MAX_LINE_LENGTH

Constructor Detail

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

Constructs a new instance from a data input stream.

Parameters
nameIndex:int

Index of name

length:int

Content length in bytes

input:DataInput

Input stream

constantPool:ConstantPool

Array of constants

Exceptions
IOException:
if an I/O Exception occurs in readUnsignedShort
LineNumberTableback to summary
public LineNumberTable(final int nameIndex, final int length, final LineNumber[] lineNumberTable, final ConstantPool constantPool)

Constructs a new instance.

Parameters
nameIndex:int

Index of name

length:int

Content length in bytes

lineNumberTable:LineNumber[]

Table of line/numbers pairs

constantPool:ConstantPool

Array of constants

LineNumberTableback to summary
public LineNumberTable(final LineNumberTable c)

Constructs a new instance from another.

Note that both objects use the same references (shallow copy). Use copy() for a physical 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 void dump(final DataOutputStream file) throws IOException

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

Dump line number table attribute to file stream in binary format.

Parameters
file:DataOutputStream

Output file stream

Annotations
@Override
Exceptions
IOException:
if an I/O Exception occurs in writeShort
getLineNumberTableback to summary
public LineNumber[] getLineNumberTable()
Returns:LineNumber[]

Array of (pc offset, line number) pairs.

getSourceLineback to summary
public int getSourceLine(final int pos)

Map byte code positions to source code lines.

Parameters
pos:int

byte code offset

Returns:int

corresponding line in source code

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

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Annotations
@Override
setLineNumberTableback to summary
public void setLineNumberTable(final LineNumber[] lineNumberTable)
Parameters
lineNumberTable:LineNumber[]

the line number entries for this table

toStringback to summary
public 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