Next Previous Up Top Contents Index

5.11 The STREAMS module

make file-stream-class

G.f method

Summary

Creates and opens a stream over a file.

Signature

make file-stream-class #key filename direction 
if-exists if-does-not-exist
buffer-size element-type
=> file-stream-instance

Arguments

file-stream-class
The class <file-stream>.

filename
An instance of <object>.

direction
One of #"input", #"output", or #"input-output". The default is #"input".

if-exists
One of #f, #"new-version", #"overwrite", #"replace", #"append", #"truncate", #"signal". Default value: #f.

if-does-not-exist
One of #f, #"signal", or #"create". Default value: depends on the value of direction.

buffer-size
An instance of <integer>.

element-type
One of <byte-character>,
<unicode-character>, or <byte>, or #f.

Values

file-stream-instance

An instance of <file-stream>.

Library

io

Module

streams

Description

Creates and opens a stream over a file.

Returns a new instance of a concrete subclass of <file-stream> that streams over the contents of the file referenced by filename. To determine the concrete subclass to be instantiated, this method calls the generic function type-for-file-stream.

The filename init-keyword should be a string naming a file. If the Locators library is in use, filename should be an instance of <locator> or a string that can be coerced to one.

The direction init-keyword specifies the direction of the stream.

The if-exists and if-does-not-exist init-keywords specify actions to take if the file named by filename does or does not already exist when the stream is created. These init-keywords are discussed in more detail in Section 5.5.1.2 on page 38.

The buffer-size init-keyword is explained in <buffered-stream>, page 36.

The element-type init-keyword specifies the type of the elements in the file named by filename. This allows file elements to be represented abstractly; for instance, contiguous elements could be treated as a single database record. This init-keyword defaults to something useful, potentially based on the properties of the file; <byte-character> and
<unicode-character> are likely choices. See Section 5.5.1.2 on page 38.

See also

<buffered-stream>, page 36

<file-stream>, page 70

type-for-file-stream, page 103


System and I/O Reference - 31 MAR 2000

Next Previous Up Top Contents Index