Next: 3.9 Types
Up: 3 The Slate World
Previous: 3.7 Streams and External
  Contents
File access in Slate is currently rudimentary. The interpreter provides
an object type FileStream which follows the corresponding
protocol:
- FileStream newNamed: filename
- returns a stream for a String
that names a path to a file, for read/write access.
- FileStream newForInputNamed: filename
- returns a stream for reading
an existing file of the given name, or Nil if it doesn't
exist.
- FileStream newForOutputNamed: filename
- returns a stream for writing
(appending) to a file with the given name.
- FileStream newForNewNamed: filename
- returns a stream for writing
(appending) to a new file with the given name. It will create a new
file, but if the file exists, Nil will be returned.
- open
- opens the file.
- exists
- answers whether there is a file with the stream's
pathname.
- close
- closes the file.
- next
- reads the next byte from the file.
- next:
- reads the next N bytes from the file.
- next:putInto:
- reads the next N bytes into the given Sequence
starting from index 0.
- next:putInto:startingAt:
- reads the N bytes into the given
Sequence starting from the given index.
- nextPutInto:
- reads into the given Sequence the
number of bytes which will fit into it.
- position
- returns the position within the file in byte units.
- position:
- sets the position within the file to the given
integer number of bytes.
- size
- returns the file size in bytes.
- nextPut: char
- writes one byte to the file.
- nextPut: seq
- writes a sequence of bytes to the file.
- name
- returns the file's pathname.
- fullName
- will always return a complete pathname whereas
the regular method may not.
- renameTo:
- adjusts the file to have the given name.
- atEnd
- answers whether the file's end has been reached.
- delete
- deletes the file.
Perhaps the most important utility is to load libraries based on path
names. 'filename' fileIn will execute a file with the given
path name as Slate source.
Next: 3.9 Types
Up: 3 The Slate World
Previous: 3.7 Streams and External
  Contents
The Slate Project
2003-07-29