2022.2

Table Of Contents
try{
// Open a reader
var reader = openTextReader(data.filename);
// 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 of the temporary file
writer.close();
}
}
finally{
// Close the reader
reader.close();
}
deleteFile(data.filename);
tmpFile.move(data.filename);
tmpFile.close();
deleteFile()
Functionthatisusedtodeleteafile.
deleteFile(filename)
filename
Stringthatspecifiesthepathandfilenameofthefiletobedeleted.
Examples
Example: Deletingafileinalocalfolder:
deleteFile("c:\Content\test.txt");
Example: DeletingthesampledatafileusedintheDataMapper:
deleteFile(data.filename);
execute()
Functionthatcallsanexternalprogramandwaitsforittoend.
execute(command)
Callsanexternalprogramandwaitsforittoend.
Page 407