org.omegahat.Environment.IO
Class InputReader

java.lang.Object
  |
  +--java.io.Reader
        |
        +--java.io.BufferedReader
              |
              +--org.omegahat.Environment.IO.InputReader
All Implemented Interfaces:
InputSupplier, java.lang.Runnable
Direct Known Subclasses:
NumberedInputReader

public class InputReader
extends java.io.BufferedReader
implements InputSupplier, java.lang.Runnable

The basic user input reader in the console version of omegahat that is parameterized by a PromptSource and allows listeners (such as an Evaluator, command auditor, history list, etc.) to register and be notified of new input. This is frequently run in a different thread.


Field Summary
protected  java.util.Vector consumers
           
protected  java.lang.StringBuffer current_line
           
protected  PromptSource promptSource
           
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
InputReader()
           
InputReader(java.io.InputStream in)
           
InputReader(java.io.InputStreamReader in)
           
InputReader(PromptSource src)
           
 
Method Summary
 boolean addInputConsumer(InputConsumer cons)
           
 java.lang.String defaultPrompt()
           
 java.lang.Object getInput()
          Read the next object from the input source inherent in the callee.
 void notifyConsumers(java.lang.String text)
           
 java.lang.String prompt()
           
 PromptSource promptSource()
           
 PromptSource promptSource(PromptSource src)
           
 boolean removeInputConsumer(InputConsumer cons)
           
 void run()
           
 
Methods inherited from class java.io.BufferedReader
close, mark, markSupported, read, read, readLine, ready, reset, skip
 
Methods inherited from class java.io.Reader
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

current_line

protected java.lang.StringBuffer current_line

consumers

protected java.util.Vector consumers

promptSource

protected PromptSource promptSource
Constructor Detail

InputReader

public InputReader()

InputReader

public InputReader(PromptSource src)

InputReader

public InputReader(java.io.InputStreamReader in)

InputReader

public InputReader(java.io.InputStream in)
Method Detail

addInputConsumer

public boolean addInputConsumer(InputConsumer cons)

removeInputConsumer

public boolean removeInputConsumer(InputConsumer cons)

getInput

public java.lang.Object getInput()
Description copied from interface: InputSupplier
Read the next object from the input source inherent in the callee.
Specified by:
getInput in interface InputSupplier

run

public void run()
Specified by:
run in interface java.lang.Runnable

prompt

public java.lang.String prompt()

notifyConsumers

public void notifyConsumers(java.lang.String text)

promptSource

public PromptSource promptSource()

promptSource

public PromptSource promptSource(PromptSource src)

defaultPrompt

public java.lang.String defaultPrompt()