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

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.

Methods:

  • close
  • isEndOfFile
  • openForAppending
  • openForReading
  • openForWriting
  • readAsData
  • readAsString
  • readLine
  • readLineAsList
  • readLineAsWhitespaceDelimitedList
  • write
  • writeLine
    close( self )

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


    isEndOfFile( self )

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


    openForAppending( self, fileName )

    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.


    openForReading( self, fileName )

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


    openForWriting( self, fileName )

    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.


    readAsData( self )

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


    readAsString( self )

    Reads the entire file and returns it as a string.


    readLine( self )

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


    readLineAsList( self, delimiterString )

    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.


    readLineAsWhitespaceDelimitedList( self )

    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( self, theText )

    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.


    writeLine( self, theText )

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