Next: Simple Streams, Up: Extensible Streams
Class precedence list:
fundamental-stream, standard-object, stream, t
the base class for all
clos
streams
Write enough blank space so that the next character will be written at the specified column. Returns true if the operation is successful, or
nil
if it is not supported for this stream. This is intended for use by bypprint
andformat
~T. The default method usesstream-line-column
and repeated calls tostream-write-char
with a #SPACE character; it returnsnil
ifstream-line-column
returnsnil
.
This is like
cl:clear-input
, but for Gray streams, returningnil
. The default method does nothing.
This is like
cl:clear-output
, but for Gray streams: clear the given outputstream
. The default method does nothing.
Attempts to ensure that all output sent to the Stream has reached its destination, and only then returns false. Implements
finish-output
. The default method does nothing.
Attempts to force any buffered output to be sent. Implements
force-output
. The default method does nothing.
Outputs a new line to the Stream if it is not positioned at the begining of a line. Returns
t
if it output a new line, nil otherwise. Used byfresh-line
. The default method usesstream-start-line-p
andstream-terpri
.
Return the column number where the next character will be written, or
nil
if that is not meaningful for this stream. The first column on a line is numbered 0. This function is used in the implementation ofpprint
and theformat
~T directive. For every character output stream class that is defined, a method must be defined for this function, although it is permissible for it to always returnnil
.
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.
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
.
Used by
read-byte
; returns either an integer, or the symbol:eof
if the stream is at end-of-file.
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
.
Is
stream
known to be positioned at the beginning of a line? It is permissible for an implementation to always returnnil
. This is used in the implementation offresh-line
. Note that while a value of 0 fromstream-line-column
also indicates the beginning of a line, there are cases wherestream-start-line-p
can be meaningfully implemented althoughstream-line-column
can't be. For example, for a window using variable-width characters, the column number isn't very meaningful, but the beginning of the line does have a clear meaning. The default method forstream-start-line-p
on classfundamental-character-output-stream
usesstream-line-column
, so if that is defined to returnnil
, then a method should be provided for eitherstream-start-line-p
orstream-fresh-line
.
Writes an end of line, as for
terpri
. Returnsnil
. The default method does (STREAM-WRITE-CHAR stream #NEWLINE).
Un-do the last call to
stream-read-char
, as inunread-char
. Returnnil
. Every subclass offundamental-character-input-stream
must define a method for this function.
Implements
write-byte
; writes the integer to the stream and returns the integer as the result.
Write
character
tostream
and returncharacter
. Every subclass offundamental-character-output-stream
must have a method defined for this function.
This is used by
write-string
. It writes the string to the stream, optionally delimited by start and end, which default to 0 andnil
. The string argument is returned. The default method provided byfundamental-character-output-stream
uses repeated calls tostream-write-char
.