FilePlayer
reads space-delimited text files at specific lines.
Inherits from:: Object : AbstractFunction : Stream : FileReader
FilePlayer is an enhanced version of FileReader, allowing to jump to specific lines in the file.
Subclasses: TabFilePlayer, CSVFilePlayer, SemiColonFilePlayer.
See also: FileReader
Creation / Class Methods
- *new(pathOrFile,skipEmptyLines,skipBlanks,delimiter)
- Create a new instance. For a description of arguments, see FileReader
Accessing Instance and Class Variables
- next
- Read the next line.
- nextInterpret
- Read the next line and interpret the result (element by element). Note: this is an extension to FileReader, so it can be used in that class too.
- readAt(line)
- Read at the given line number
- readAtInterpret(line)
- Read at the given line number, and interpret the result (element by element)
- goToLine(line)
- Go to the given line (this does not read the line)
- currentLine
- The current line where we are in the file.
- length
- Length of the file
- reset
- Reset the stream. I.e. go to the start of the file.
- setCurrentLine(cl)
- Set the current line number (used internally)
Example 1
f = TabFileWriter.new( "testfile2.txt", "w", true);
Task({
20.do{
f.writeLine( Array.fill( 10, { 1.0.rand }));
1.0.wait;
};
"done".postln;
}).play;
f.close;
"testfile2.txt".openDocument;
a = TabFilePlayer.new( "testfile2.txt" );
a.next;
a.readAt( 10 );
a.readAt( 5 );
a.readAt( 20 );
This helpfile was created with the class HelpFile2