|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gshute.ioutil.LineStream
A LineStream dispenses LineScanners for lines read from ILineSources organized as a stack. New ILineSources can be pushed onto the stack by calling insertBatchLines() or insertInteractiveLines(). An ILineSource is automatically popped from the stack when it has no more lines.
Field Summary | |
protected java.util.Stack |
otherSources
otherSources is the Stack of other sources for this LineStream. |
protected ILineSource |
topSource
topSource is the current source for this LineStream. |
Constructor Summary | |
LineStream()
LineStream() returns an empty LineStream. |
|
LineStream(LineSource src)
LineStream(src) returns a LineStream that begins reading from src. |
|
LineStream(java.lang.String prmt)
LineStream(prmt) returns a LineStream that begins reading from the terminal using prmt for prompting. |
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 input position of src. |
void |
endInsert()
strm.endInsert() terminates an insert begun by insertInteractiveLines() or insertBatchLines(). |
Command |
endInsertCommand(java.lang.String nm)
strm.endInsertCommand(nm) returns a Command whose name is nm. |
java.lang.String |
getFileName()
src.getFileName() Returns the name of the file from which src reads lines. |
int |
getLineNumber()
src.getLineNumber() returns the line number of the current line in src. |
void |
insertBatchLines(java.lang.String fn)
strm.insertBatchLines(fn) inserts lines read from the file named by fn into the stream of lines read by strm. |
void |
insertInteractiveLines(java.lang.String prmt)
strm.insertInteractiveLines(prmt) inserts lines read from the terminal into the stream of lines read by strm. |
Command |
insertLinesCommand(java.lang.String nm)
strm.insertLinesCommand(nm) returns a Command whose name is nm. |
boolean |
more()
src.more() returns true if there is a line at the current input position of src, false if not. |
protected void |
push(ILineSource src)
push(src) pushes topSource onto otherSources and replaces topSource by src. |
void |
setEchoOff()
src.setEchoOff() turns echoing off for the top LineSource in src. |
Command |
setEchoOffCommand(java.lang.String nm)
strm.setEchoOffCommand(nm) returns a Command whose name is nm. |
void |
setEchoOn()
src.setEchoOn() turns echoing on for the top LineSource in src. |
Command |
setEchoOnCommand(java.lang.String nm)
strm.setEchoOnCommand(nm) returns a Command whose name is nm. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected ILineSource topSource
protected java.util.Stack otherSources
Constructor Detail |
public LineStream() throws java.io.IOException, java.io.FileNotFoundException
public LineStream(java.lang.String prmt) throws java.io.IOException, java.io.FileNotFoundException
public LineStream(LineSource src) throws java.io.IOException, java.io.FileNotFoundException
Precondition: src is not null.
Method Detail |
public boolean more() throws java.io.IOException
public LineScanner current() throws java.io.IOException
Precondition: src.more() is true.
public void advance() throws java.io.IOException
Precondition: src.more() is true.
public int getLineNumber()
public java.lang.String getFileName()
public void setEchoOn()
public void setEchoOff()
public void insertBatchLines(java.lang.String fn) throws java.io.FileNotFoundException, java.io.IOException
public void insertInteractiveLines(java.lang.String prmt) throws java.io.IOException
public void endInsert()
public Command setEchoOnCommand(java.lang.String nm)
public Command setEchoOffCommand(java.lang.String nm)
public Command insertLinesCommand(java.lang.String nm)
public Command endInsertCommand(java.lang.String nm)
protected void push(ILineSource src) throws java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |