2022.2

Table Of Contents
append
Booleanparameterthatspecifieswhetherthefilepointershouldinitiallybepositionedattheendofthe
existingfile(appendmode)oratthebeginningofthefile(overwritemode).
openTextReader()
Functionthatopensafileasatextfileforreadingpurposes.Thefunctionreturnsa"TextReader"below
object.Pleasenotethatthetemporaryfilemustbeclosedattheend.
openTextReader(filename,encoding)
filename
Stringthatrepresentsthenameofthefiletoopen.
encoding
Stringthatspecifiestheencodingofthefiletoread(UTF-8,ISO-8859-1,etc.).
Example
Inthefollowingexample,theopenTextReader()functionisusedtoopentheactualdatasamplefile
intheDataMapperforreading.
var fileIn = openTextReader(data.filename);
var tmp = createTmpFile();
var fileOut = openTextWriter(tmp.getPath());
var line;
while((line = fileIn.readLine())!=null){
fileOut.write(line.replace((subject),""));
fileOut.newLine();
}
fileIn.close();
fileOut.close();
deleteFile(data.filename);
tmp.move(data.filename);
TextReader
TheTextReaderobject,returnedbytheopenTextReader()function,allowstoopen,parse,readand
closeatextfile.(See:"openTextReader()"above.)
Methods
ThefollowingtabledescribesthemethodsoftheTextReaderobject.
Method Description
close() Closesthestreamandreleasesresources.
Page 410