gshute.ioutil
Class InteractiveLineSource

java.lang.Object
  |
  +--gshute.ioutil.LineSource
        |
        +--gshute.ioutil.InteractiveLineSource

public class InteractiveLineSource
extends LineSource

An InteractiveLineSource dispenses LineScanners for lines read from the terminal.


Field Summary
protected  java.lang.String prompt
          prompt is the prompt used by this InteractiveLineSource.
protected static java.io.BufferedReader terminal
          terminal is the BufferedReader used by all InteractiveLineSources as an input stream.
 
Fields inherited from class gshute.ioutil.LineSource
currentLine, dataReader, echoOn, echoPolicy, fileName, includedFrom, lineIsValid, lineNumber
 
Method Summary
 LineScanner current()
          src.current() returns the line at the current position of src.
protected  void initialize()
          strm.initialize() establishes the InteractiveLineSource starting conditions for strm.
protected  void validateCurrentLine()
          strm.validateCurrentLine() ensures that currentLine is the line at the current position in strm.
 
Methods inherited from class gshute.ioutil.LineSource
advance, getFileName, getIncludedFrom, getLineNumber, more, setEchoOff, setEchoOn, setIncludedFrom
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prompt

protected java.lang.String prompt
prompt is the prompt used by this InteractiveLineSource.

terminal

protected static java.io.BufferedReader terminal
terminal is the BufferedReader used by all InteractiveLineSources as an input stream.
Method Detail

current

public LineScanner current()
                    throws java.io.IOException,
                           java.lang.IllegalArgumentException
src.current() returns the line at the current position of src.

Precondition: src.more() is true.

Overrides:
current in class LineSource

validateCurrentLine

protected void validateCurrentLine()
                            throws java.io.IOException
strm.validateCurrentLine() ensures that currentLine is the line at the current position in strm. The line at the end of file position is a null object. For an InteractiveLineSource, a prompt should be issued before the line is validated.
Overrides:
validateCurrentLine in class LineSource

initialize

protected void initialize()
                   throws java.io.IOException,
                          java.io.FileNotFoundException
strm.initialize() establishes the InteractiveLineSource starting conditions for strm.
Overrides:
initialize in class LineSource