tools.code
Class CodeLineInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by tools.code.CodeLineInputStream
All Implemented Interfaces:
java.io.Closeable

public class CodeLineInputStream
extends java.io.InputStream

This class implements an InputStream over a list of CodeLine lines. This is useful for a parser that reads constructs that span several lines. This stream only traverses opcode data ... not labels or comments.


Constructor Summary
CodeLineInputStream(java.util.List<CodeLine> codeLines, int startLineNumber, int startPosition)
          This constructs a new CodeLineInputStream
 
Method Summary
 int getCurrentFileLineNumber()
          This method returns the current line number within the list of CodeLine lines.
 java.lang.String getCurrentFilename()
          This method returns the name of the file of the current line.
 CodeLine getCurrentLine()
          This method returns the current line
 int getCurrentLineNumber()
          This method returns the current line index in the array of code lines.
 int getCurrentPosition()
          This method return the current character index of the current line.
 int read()
           
 
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CodeLineInputStream

public CodeLineInputStream(java.util.List<CodeLine> codeLines,
                           int startLineNumber,
                           int startPosition)
This constructs a new CodeLineInputStream

Parameters:
codeLines - the list of CodeLine lines
startLineNumber - the starting line number
startPosition - the starting position within the starting line
Method Detail

getCurrentLineNumber

public int getCurrentLineNumber()
This method returns the current line index in the array of code lines.

Returns:
current line index (not the same as the line number in the original file)

getCurrentFileLineNumber

public int getCurrentFileLineNumber()
This method returns the current line number within the list of CodeLine lines.

Returns:
the current line number

getCurrentPosition

public int getCurrentPosition()
This method return the current character index of the current line.

Returns:
current character index of the current line

getCurrentFilename

public java.lang.String getCurrentFilename()
This method returns the name of the file of the current line.

Returns:
filename of the current line

getCurrentLine

public CodeLine getCurrentLine()
This method returns the current line

Returns:
the current CodeLine

read

public int read()
Specified by:
read in class java.io.InputStream