nachos.userprog
Class SynchConsole
java.lang.Object
|
+--nachos.userprog.SynchConsole
- public class SynchConsole
- extends Object
Provides a simple, synchronized interface to the machine's console. The
interface can also be accessed through OpenFile objects.
|
Method Summary |
OpenFile |
openForReading()
Return an OpenFile that can be used to read this as a file. |
OpenFile |
openForWriting()
Return an OpenFile that can be used to write this as a file. |
int |
readByte(boolean block)
Return the next unsigned byte received (in the range 0 through
255). |
void |
writeByte(int value)
Send a byte. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
SynchConsole
public SynchConsole(SerialConsole console)
- Allocate a new SynchConsole.
- Parameters:
console - the underlying serial console to use.
readByte
public int readByte(boolean block)
- Return the next unsigned byte received (in the range 0 through
255). If a byte has not arrived at, blocks until a byte
arrives, or returns immediately, depending on the value of block.
- Parameters:
block - true if readByte() should wait for a
byte if none is available.- Returns:
- the next byte read, or -1 if block was false
and no byte was available.
openForReading
public OpenFile openForReading()
- Return an OpenFile that can be used to read this as a file.
- Returns:
- a file that can read this console.
writeByte
public void writeByte(int value)
- Send a byte. Blocks until the send is complete.
- Parameters:
value - the byte to be sent (the upper 24 bits are ignored).
openForWriting
public OpenFile openForWriting()
- Return an OpenFile that can be used to write this as a file.
- Returns:
- a file that can write this console.