1.6

Table Of Contents
access to a physical file when writing. In the end, the contents is transferred into a physical file
for which only a single input/output access will occur.
Examples
In the following script, a file is read in a created temporary file:
try{
// Create a temporary file
var tmpFile = createTmpFile();
// Open a writer on the temporary file
var writer = openTextWriter(tmpFile.getPath());
try{
var line = null; // Current line
// read line by line and readLine will return null at the
end of the file.
while((line = reader.readLine()) != null ){
// Edit the line
line = line.toUpperCase();
// Write the result in the temporary file
writer.write(line);
// add a new line
writer.newLine();
}
}
finally{
// Close the writer or the temporary file
writer.close();
}
}
finally{
// Close the reader
reader.close();
}
deleteFile()
Function used to delete a file.
deleteFile(filename)
Deletes a file.
filename
Page 236