Page 350 Table of Contents Index Page 352
Chapters
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
A, B, C, D, E



APPENDIX C. COMMON LISP STREAMS

fundamental-character-input-stream simply calls stream-read-char; this is sufficient for
file streams, but interactive streams should define their own method.

=> stream-peek-char stream [Generic Function]
Returns either a character or :eof without removing the character from the stream's input
buffer. This is used to implement peek-char; this corresponds to peek-type of nil. The default
method calls stream-read-char and stream-unread-char.

=> stream-listen stream [Generic Function]
Returns true if there is any input pending on stream, otherwise it returns false. This is used
by listen. The default method uses stream-read-char-no-hang and stream-unread-char.
Most streams should define their own method since it will usually be trivial and will generally
be more efficient than the default method.

=> stream-read-line stream [Generic Function]
Returns a string as the first value, and t as the second value if the string was terminated by
end-of-file instead of the end of a line. This is used by read-line. The default method uses
repeated calls to stream-read-char.

=> stream-clear-input stream [Generic Function]
Clears any buffered input associated with stream, and returns false. This is used to implement
clear-input. The default method does nothing.

C.4 Character Output

A character output stream can be created by defining a class that includes fundamental-
character-output-stream
and defining methods for the generic functions below.

=> stream-write-char stream character [Generic Function]
Writes character to stream, and returns character as its value. Every subclass of fundamental-
character-output-stream
must have a method defined for this function.

=> stream-line-column stream [Generic Function]
This function returns the column number where the next character will be written on stream, or
nil if that is not meaningful. The first column on a line is numbered 0. This function is used
in the implementation of pprint and the format ~T directive. Every character output stream
class must define a method for this, although it is permissible for it to always return nil.

=> stream-start-line-p stream [Generic Function]
Returns true if stream is positioned at the beginning of a line, otherwise returns false. It is
permissible to always return false. This is used in the implementation of fresh-line.


Page 350 Table of Contents Index Page 352
Chapters
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
A, B, C, D, E