Next: , Up: Extensible Streams


9.1 Gray Streams

— Class: sb-gray:fundamental-stream

Class precedence list: fundamental-stream, standard-object, stream, t

the base class for all clos streams

— Generic Function: sb-gray:stream-advance-to-column stream column

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 by pprint and format ~T. The default method uses stream-line-column and repeated calls to stream-write-char with a #SPACE character; it returns nil if stream-line-column returns nil.

— Generic Function: sb-gray:stream-clear-input non-stream

This is like cl:clear-input, but for Gray streams, returning nil. The default method does nothing.

— Generic Function: sb-gray:stream-clear-output non-stream

This is like cl:clear-output, but for Gray streams: clear the given output stream. The default method does nothing.

— Generic Function: sb-gray:stream-finish-output non-stream

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.

— Generic Function: sb-gray:stream-force-output non-stream

Attempts to force any buffered output to be sent. Implements force-output. The default method does nothing.

— Generic Function: sb-gray:stream-fresh-line stream

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 by fresh-line. The default method uses stream-start-line-p and stream-terpri.

— Generic Function: sb-gray:stream-line-column stream

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 of pprint and the format ~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 return nil.

— Generic Function: sb-gray:stream-line-length stream

Return the stream line length or nil.

— Generic Function: sb-gray:stream-listen stream

This is used by listen. It returns true or false. 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 always be more efficient than the default method.

— Generic Function: sb-gray:stream-peek-char stream

This is used to implement peek-char; this corresponds to peek-type of nil. It returns either a character or :eof. The default method calls stream-read-char and stream-unread-char.

— Generic Function: sb-gray:stream-read-byte non-stream

Used by read-byte; returns either an integer, or the symbol :eof if the stream is at end-of-file.

— Generic Function: sb-gray:stream-read-char-no-hang stream

This is used to implement read-char-no-hang. It returns either a character, or nil if no input is currently available, or :eof if end-of-file is reached. The default method provided by fundamental-character-input-stream simply calls stream-read-char; this is sufficient for file streams, but interactive streams should define their own method.

— Generic Function: sb-gray:stream-read-char stream

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 of fundamental-character-input-stream must define a method for this function.

— Generic Function: sb-gray:stream-read-line stream

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 to stream-read-char.

— Generic Function: sb-gray:stream-read-sequence stream seq &optional start end

This is like cl:read-sequence, but for Gray streams.

— Generic Function: sb-gray:stream-start-line-p stream

Is stream known to be positioned at the beginning of a line? It is permissible for an implementation to always return nil. This is used in the implementation of fresh-line. Note that while a value of 0 from stream-line-column also indicates the beginning of a line, there are cases where stream-start-line-p can be meaningfully implemented although stream-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 for stream-start-line-p on class fundamental-character-output-stream uses stream-line-column, so if that is defined to return nil, then a method should be provided for either stream-start-line-p or stream-fresh-line.

— Generic Function: sb-gray:stream-terpri stream

Writes an end of line, as for terpri. Returns nil. The default method does (STREAM-WRITE-CHAR stream #NEWLINE).

— Generic Function: sb-gray:stream-unread-char stream character

Un-do the last call to stream-read-char, as in unread-char. Return nil. Every subclass of fundamental-character-input-stream must define a method for this function.

— Generic Function: sb-gray:stream-write-byte non-stream integer

Implements write-byte; writes the integer to the stream and returns the integer as the result.

— Generic Function: sb-gray:stream-write-char stream character

Write character to stream and return character. Every subclass of fundamental-character-output-stream must have a method defined for this function.

— Generic Function: sb-gray:stream-write-sequence stream seq &optional start end

This is like cl:write-sequence, but for Gray streams.

— Generic Function: sb-gray:stream-write-string stream string &optional start end

This is used by write-string. It writes the string to the stream, optionally delimited by start and end, which default to 0 and nil. The string argument is returned. The default method provided by fundamental-character-output-stream uses repeated calls to stream-write-char.