Implements the standard behavior as a generic function.
common-lisp
close stream &key abort => result
close :around (stream buffered-stream) &key abort
close (stream buffered-stream) &key abort
stream⇩ |
A stream. |
abort⇩ |
A generalized boolean. |
result |
A boolean. |
The generic function close
implements the standard function. All external resources used by the stream should be freed and true returned when that has been done. The result value for close
is as per the Common Lisp ANSI specification.
When stream is an instance of a subclass of buffered-stream, if abort is true then any remaining data in the buffer can be discarded. There are two built-in methods on buffered-stream. The primary method specialized on buffered-stream returns t
. The other, an around method specialized on buffered-stream, checks whether the stream is closed, and if it is does nothing, including not calling the next method, which means not doing any of the primary, before and after methods. If the stream is opened, it flushes the stream buffer if abort is nil
, calls the next method and marks the stream as closed if that method returns true. Thus the only requirement for a primary method specialized on a subclass of buffered-stream is that it must close any underlying data source and return true.
close
method on the fundamental-stream class sets a flag for open-stream-p
close in the Common Lisp HyperSpec
buffered-stream
fundamental-stream
open-stream-p
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:30