gshute.ioutil
Class LineSource

java.lang.Object
  |
  +--gshute.ioutil.LineSource
Direct Known Subclasses:
BatchLineSource, InteractiveLineSource

public abstract class LineSource
extends java.lang.Object
implements ILineSource

Class LineSource implements the ILineSource methods for its subclasses. Subclasses may reimplement these methods as needed.


Field Summary
protected  java.lang.String currentLine
          currentLine is the current line for this LineSource.
protected  java.io.BufferedReader dataReader
          dataReader is the BufferReader for the file named by fileName.
protected  boolean echoOn
          echoOn is true if this LineScanner should echo the lines that it reads.
protected  int echoPolicy
          echoPolicy indicates whether or not a LineScanner from this LineSource should echo the line before reporting errors.
protected  java.lang.String fileName
          fileName is the name of the file that this LineScanner reads lines from.
protected  LineSource includedFrom
          includedFrom is the source from which this LineSource has been included.
protected  boolean lineIsValid
          lineIsValid is true when currentLine has been set to the current line for this LineScanner or set to null at the end of file.
protected  int lineNumber
          lineNumber is the line number of currentLine.
 
Constructor Summary
LineSource()
           
 
Method Summary
 void advance()
          src.advance() advances the input position of src to the next line.
 LineScanner current()
          src.current() returns the line at the current position of src.
 java.lang.String getFileName()
          src.getFileName() Returns the name of the file from which src reads lines.
 LineSource getIncludedFrom()
          src.getIncludedFrom() returns the LineSource that src is included from, or null if there is no such LineSource.
 int getLineNumber()
          src.getLineNumber() returns the line number of the current line in src.
protected  void initialize()
          strm.initialize() establishes the LineSource starting conditions for strm.
 boolean more()
          src.more() returns true if there is a line at the current input position of src, false if not.
 void setEchoOff()
          src.setEchoOff() turns echoing off for src if src supports echo control.
 void setEchoOn()
          src.setEchoOn() turns echoing on for src if src supports echo control.
 void setIncludedFrom(LineSource from)
          src.setIncludedFrom(from) sets the includedFrom link for src to from.
protected  void validateCurrentLine()
          strm.validateCurrentLine() ensures that currentLine is the line at the current position in strm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

echoPolicy

protected int echoPolicy
echoPolicy indicates whether or not a LineScanner from this LineSource should echo the line before reporting errors.

currentLine

protected java.lang.String currentLine
currentLine is the current line for this LineSource.

lineNumber

protected int lineNumber
lineNumber is the line number of currentLine.

includedFrom

protected LineSource includedFrom
includedFrom is the source from which this LineSource has been included.

fileName

protected java.lang.String fileName
fileName is the name of the file that this LineScanner reads lines from.

dataReader

protected java.io.BufferedReader dataReader
dataReader is the BufferReader for the file named by fileName.

echoOn

protected boolean echoOn
echoOn is true if this LineScanner should echo the lines that it reads.

lineIsValid

protected boolean lineIsValid
lineIsValid is true when currentLine has been set to the current line for this LineScanner or set to null at the end of file.
Constructor Detail

LineSource

public LineSource()
Method Detail

more

public boolean more()
             throws java.io.IOException
src.more() returns true if there is a line at the current input position of src, false if not.
Specified by:
more in interface ILineSource

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.

Specified by:
current in interface ILineSource

advance

public void advance()
             throws java.io.IOException,
                    java.lang.IllegalArgumentException
src.advance() advances the input position of src to the next line.

Precondition: src.more() is true.

Specified by:
advance in interface ILineSource

getLineNumber

public int getLineNumber()
src.getLineNumber() returns the line number of the current line in src.
Specified by:
getLineNumber in interface ILineSource

getFileName

public java.lang.String getFileName()
src.getFileName() Returns the name of the file from which src reads lines.
Specified by:
getFileName in interface ILineSource

setEchoOn

public void setEchoOn()
src.setEchoOn() turns echoing on for src if src supports echo control. If not, then setEchoOn has no effect.
Specified by:
setEchoOn in interface ILineSource

setEchoOff

public void setEchoOff()
src.setEchoOff() turns echoing off for src if src supports echo control. If not, then setEchoOff has no effect.
Specified by:
setEchoOff in interface ILineSource

getIncludedFrom

public LineSource getIncludedFrom()
src.getIncludedFrom() returns the LineSource that src is included from, or null if there is no such LineSource.

setIncludedFrom

public void setIncludedFrom(LineSource from)
src.setIncludedFrom(from) sets the includedFrom link for src to from.

initialize

protected void initialize()
                   throws java.io.IOException,
                          java.io.FileNotFoundException
strm.initialize() establishes the LineSource starting conditions for strm.

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.