All Manuals > LispWorks User Guide and Reference Manual > 48 The STREAM Package

NextPrevUpTopContentsIndex

stream-listen

Generic Function
Summary

A function used by listen that returns t if there is input available.

Package

stream

Signature

stream-listen stream => result

Arguments

stream

A stream.

Values

result

A generalized boolean.

Description

The generic function stream-listen is called to determine if there is data immediately available on the stream stream, without hanging.

result should be true if here is input, and nil otherwise (including at end of file).

This method must be implemented for subclasses of buffered-stream that handle input.

There is a built-in primary method specialized on buffered-stream which returns nil. There is a built-in :around method specialized on buffered-stream which checks for input in the buffer and calls the next method if the buffer is empty. Thus a primary method specialized on a subclass of buffered-stream need only check the underlying data source.

The built-in method on fundamental-input-stream uses stream-read-char-no-hang and stream-unread-char. Most streams should define their own method as this is usually trivial and more efficient than the method provided.

See also

buffered-stream
stream-read-char-no-hang
stream-unread-char


LispWorks User Guide and Reference Manual - 13 Feb 2015

NextPrevUpTopContentsIndex