|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnachos.machine.Console
public abstract class Console
This class defines a hardware console device. There are two kinds of console that have been implemented: A stream console, which takes its input from an InputStream (such as System.in) and writes its output to a PrintStream (such as System.out), and a GUI console, which takes interactive input from the keyboard and outputs to a display window. The GUI console is more realistic, in that interrupts occur immediately when a key is pressed, rather than waiting for the end of the line. Since the device is asynchronous, the interrupt handler "readAvail" is called when a character has arrived, ready to be read in. The interrupt handler "writeDone" is called when an output character has been "put", so that the next character can be written.
Method Summary | |
---|---|
char |
getChar()
Read a character from the input buffer, assuming there is one. |
static Console |
guiConsole()
Factory method for creating a GUIConsole operating in PIO mode. |
static Console |
guiConsole(InterruptHandler readAvail,
InterruptHandler writeDone)
Factory method for creating a GUIConsole. |
boolean |
isInputAvail()
Poll the console to see if there is an input character available. |
boolean |
isOutputBusy()
Poll the console to see if it is busy outputting a character. |
void |
putChar(char ch)
Write a character to the simulated display and return. |
void |
stop()
Stop the console, disabling interrupt handlers. |
static Console |
streamConsole(java.lang.String rdFile,
java.lang.String wrFile)
Factory method for creating a StreamConsole operating in PIO mode. |
static Console |
streamConsole(java.lang.String rdFile,
java.lang.String wrFile,
InterruptHandler readAvail,
InterruptHandler writeDone)
Factory method for creating a StreamConsole. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Console streamConsole(java.lang.String rdFile, java.lang.String wrFile, InterruptHandler readAvail, InterruptHandler writeDone)
rdFile
- Java stream simulating the keyboard (null -> use stdin)wrFile
- Java stream simulating the display (null -> use stdout)readAvail
- is the interrupt handler called when a character
arrives from the keyboard (null -> PIO mode)writeDone
- is the interrupt handler called when a character has
been output, so that it is ok to request the next char be
output (null -> PIO mode)public static Console streamConsole(java.lang.String rdFile, java.lang.String wrFile)
rdFile
- Java stream simulating the keyboard (null -> use stdin)wrFile
- Java stream simulating the display (null -> use stdout)
public static Console guiConsole(InterruptHandler readAvail, InterruptHandler writeDone)
readAvail
- is the interrupt handler called when a character
arrives from the keyboard (null -> PIO mode)writeDone
- is the interrupt handler called when a character has
been output, so that it is ok to request the next char be
output (null -> PIO mode)
public static Console guiConsole()
public void stop()
public boolean isInputAvail()
public char getChar()
public boolean isOutputBusy()
public void putChar(char ch)
ch
- The character to be written.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |