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.