All Manuals > LispWorks User Guide and Reference Manual > 33 The COMMON-LISP Package

NextPrevUpTopContentsIndex

close

Generic Function
Summary

The function close is implemented as a generic function.

Package

common-lisp

Signature

close stream &key abort => result

Method signatures

close :around (stream buffered-stream) &key abort

close (stream buffered-stream) &key abort

Arguments

stream

A stream.

abort

A generalized boolean.

Values

result

A boolean.

Description

The standard function close is implemented as a generic 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.

Notes
  1. You should not define an around method on a subclass of buffered-stream, as that will happen around the around method on buffered-stream. Use before and after methods instead.
  2. The close method on the fundamental-stream class sets a flag for open-stream-p
See also

buffered-stream
fundamental-stream
open-stream-p


LispWorks User Guide and Reference Manual - 13 Feb 2015

NextPrevUpTopContentsIndex