Class LineReader

java.lang.Object
  |
  +--LineReader

class LineReader
extends java.lang.Object

Simple class to read lines in from a file. To use, create a LineReader object, then send it the readLine() message for each line you want to read. When readLine() returns the value null, there are no lines remaining.


Constructor Summary
LineReader()
          Creates a LineReader to read lines (as Strings) from a file.
LineReader(java.lang.String message)
          Creates a LineReader to read lines (as Strings) from a file.
 
Method Summary
 void close()
          Closes the file used by the LineReader.
 java.lang.String readLine()
          Reads a line from the file defined by the constructor.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineReader

public LineReader()
Creates a LineReader to read lines (as Strings) from a file. Calling this constructor causes a standard file dialog box to open, allowing the user to choose a file; the message "Read lines from what file?" is displayed at the top of the dialog box.

LineReader

public LineReader(java.lang.String message)
Creates a LineReader to read lines (as Strings) from a file. Calling this constructor causes a standard file dialog box to open, allowing the user to choose a file; the message is displayed at the top of the dialog box.
Parameters:
message - the message to be displayed in the dialog box.
Method Detail

close

public void close()
Closes the file used by the LineReader.

readLine

public java.lang.String readLine()
Reads a line from the file defined by the constructor. When there are no remaining lines, null is returned.
Returns:
the next line, or null if no lines remain.


Generated by BlueJ