gnu.mapping

Class TtyInPort

public class TtyInPort extends InPort

An interactive input-port. Supports prompting, auto-flush of tied output port, transcripts.
Field Summary
protected Procedureprompter
protected booleanpromptEmitted
protected OutPorttie
Constructor Summary
TtyInPort(InputStream in, Path name, OutPort tie)
TtyInPort(Reader in, Path name, OutPort tie)
Method Summary
intfill(int len)
ProceduregetPrompter()
Get the current prompter function.
voidlineStart(boolean revisited)
intread()
intread(char[] cbuf, int off, int len)
voidsetPrompter(Procedure prompter)
Set the prompter function.

Field Detail

prompter

protected Procedure prompter

promptEmitted

protected boolean promptEmitted

tie

protected OutPort tie

Constructor Detail

TtyInPort

public TtyInPort(InputStream in, Path name, OutPort tie)

TtyInPort

public TtyInPort(Reader in, Path name, OutPort tie)

Method Detail

fill

public int fill(int len)

getPrompter

public Procedure getPrompter()
Get the current prompter function.

lineStart

public void lineStart(boolean revisited)

read

public int read()

read

public int read(char[] cbuf, int off, int len)

setPrompter

public void setPrompter(Procedure prompter)
Set the prompter function. The argument is called when a new line is read. It is passed one argument (this input port), and should return a string. That string is printed as the prompt string.