Next Previous Up Top Contents Index

5.5.1 Creating streams

5.5.1.1 File streams

File streams are intended only for accessing the contents of files. More general file handling facilities, such as renaming, deleting, moving, and parsing directory names, are provided by the File-System module: see Chapter 8, "The File-System Module" for details. The make method on <file-stream> does not create direct instances of <file-stream>, but instead an instance of a subclass determined by type-for-file-stream.

make file-stream-class

G.f method

make <file-stream> #key locator: direction: if-exists: 
       if-does-not-exist: buffer-size: element-type: 
       asynchronous?: share-mode => file-stream-instance 

Creates and opens a stream over a file, and 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 locator: 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. This can be one of #"input", #"output", or #"input-output". The default is #"input".
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 can be used to suggest the size of a stream's buffer. See <buffered-stream>, page 62.
The element-type: init-keyword specifies the type of the elements in the file named by filename. See Section 5.5.1.2 on page 38 for more details.

System and I/O Reference - 31 MAR 2000

Next Previous Up Top Contents Index