csli.util.file
Class LineReader

java.lang.Object
  extended by csli.util.file.LineReader

public class LineReader
extends Object

Simple line-by-line file reader, with the ability to push back lines.

Author:
Danilo Mirkovic

Constructor Summary
LineReader(File file)
           
LineReader(String filename)
           
 
Method Summary
 void close()
          Clsoes the underlying stream.
 void pushBack(String line)
          Push back a line.
 String readLine()
          Returns the line, not including terminating characters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineReader

public LineReader(File file)
           throws FileNotFoundException
Throws:
FileNotFoundException

LineReader

public LineReader(String filename)
           throws FileNotFoundException
Throws:
FileNotFoundException
Method Detail

readLine

public String readLine()
                throws IOException
Returns the line, not including terminating characters. Returns null if past the end of file.

Throws:
IOException

pushBack

public void pushBack(String line)
Push back a line. It will be the first one out when you use readLine.


close

public void close()
           throws IOException
Clsoes the underlying stream.

Throws:
IOException