Next: Character output stream methods, Previous: Binary stream methods, Up: Gray Streams
These generic functions are used to implement subclasses of fundamental-input-stream:
This is used to implement
peek-char
; this corresponds topeek-type
ofnil
. It returns either a character or:eof
. The default method callsstream-read-char
andstream-unread-char
.
This is used to implement
read-char-no-hang
. It returns either a character, ornil
if no input is currently available, or:eof
if end-of-file is reached. The default method provided byfundamental-character-input-stream
simply callsstream-read-char
; this is sufficient for file streams, but interactive streams should define their own method.
Read one character from the stream. Return either a character object, or the symbol
:eof
if the stream is at end-of-file. Every subclass offundamental-character-input-stream
must define a method for this function.
This is used by
read-line
. A string is returned as the first value. The second value is true if the string was terminated by end-of-file instead of the end of a line. The default method uses repeated calls tostream-read-char
.
This is used by
listen
. It returns true or false. The default method usesstream-read-char-no-hang
andstream-unread-char
. Most streams should define their own method since it will usually be trivial and will always be more efficient than the default method.