These pages are auto-generated from self-documenting comments embedded in class files.
For more information on breve and steve, refer to the breve homepage.

## Abstract : File

This class is included as part of the file File.tz.
To use this class in a simulation, include the line "@use File."

### Class description:

> A File is an object used for creating textual output of your breve simulation, or for reading in data from text files.

> Though some File methods can be used to encode or decode simulation objects, it is not the preferred method for archiving and dearchiving objects--for a discussion of archiving and dearchiving objects, see the Archiving and Dearchiving section of the breve documentation.

### Class methods:

> Checking For the End of a File

> - is-end-of-file

> Opening Files

> - open-for-appending
> - open-for-reading
> - open-for-writing

> Reading from an Open File

> - read-as-data
> - read-as-string
> - read-line
> - read-line-as-list
> - read-line-as-whitespace-delimited-list

> Writing to an Open File

> - write
> - write-line

> Closing a File

> - close

`close`

> Closes the file. This should be done when you're finished reading from or writing to a file.

`is-end-of-file`

> Returns whether the file pointer is at the end of the file.

`open-for-appending with-file fileName (string)`

> Opens fileName for appending. If the file already exists, future writes will append text to the end of the file instead of overwriting it. If the file does not exist, it is created.

> To be used with the methods write, write-line and write-data below.

`open-for-reading with-file fileName (string)`

> Opens fileName for reading. To be used with the methods read-as-string, read-as-data and read-line below.

`open-for-writing with-file fileName (string)`

> Opens fileName for writing. If the file already exists, it is truncated to length zero so that this method effectively overwrites files. If the file does not exist, it is created.

> To be used with the methods write, write-line and write-data below.

`read-as-data`

> Reads the entire file as binary data and returns a "data" type (not to be confused with a Data object).

`read-as-string`

> Reads the entire file and returns it as a string.

`read-line`

> Reads a single line of text from the file (ending with a newline). The size of the line read is limited to 10239.

`read-line-as-list with-delimiter delimiterString (string)`

> Reads a line from the file and returns the results as a list of elements delimited by delimiterString. The size of the line read is limited to 10239.

`read-line-as-whitespace-delimited-list`

> Reads a line from the file and returns the results as a list of elements delimited by whitespace. The size of the line read is limited to 10239.

`write text theText (string)`

> Writes the string theText to the file. This method does not write a newline character to the end of the string. See write-line for writing a string with a newline character.

`write-line text theText (string)`

> Writes the string theText to the file, with a newline character at the end. Like write, but includes a newline character.

Documentation created Thu Jul 3 18:18:12 2008