Skip to main content

file-stream

file-stream System Class

Class Precedence List:

file-stream, stream, t

Description:

An object of type file-stream is a stream the direct source or sink of which is a file. Such a stream is created explicitly by open and with-open-file, and implicitly by functions such as load that process files.

See Also:

load, open, with-open-file

Expanded Reference: file-stream

Overview

file-stream is a system class for streams whose direct source or sink is a file. Such streams are created by open and with-open-file.

Type Check

(with-open-file (s "/tmp/cl-fs-test.txt"
:direction :output :if-exists :supersede)
(typep s 'file-stream))
=> T

Distinguishing from String Streams

String streams are not file streams.

(typep (make-string-output-stream) 'file-stream)
=> NIL

Class Hierarchy

(subtypep 'file-stream 'stream)
=> T
=> T

Created by open and with-open-file

Both open and with-open-file produce file streams.

(let ((s (open "/tmp/cl-fs-test.txt" :direction :probe)))
(prog1 (typep s 'file-stream)
(close s)))
=> T