Public Member Functions | List of all members
TextFile Class Reference

Inherits ScriptObject.

Public Member Functions

 TextFile (String path, Boolean write, String encoding)
 
Boolean isOpen ()
 
String readln ()
 
 write (String text)
 
 writeln (String text)
 
 close ()
 

Detailed Description

Text file.

Security: Requires security level 0.

var path = FileSystem.replaceExtension(getOutputPath(), ".txt");
var file = new TextFile(path, true, "ansi");
file.writeln("Hello World!");
file.close();

Constructor & Destructor Documentation

◆ TextFile()

TextFile ( String  path,
Boolean  write,
String  encoding 
)

Opens a text file for reading/writing.

Parameters
pathThe path of the file to open.
writeSpecifies if the file should be written or read.
encodingThe encoding of the text file.

Member Function Documentation

◆ close()

close ( )

Closes the file.

◆ isOpen()

Boolean isOpen ( )

Returns true if the file is open.

◆ readln()

String readln ( )

Reads a line.

◆ write()

write ( String  text)

Writes the specified text without end-of-line.

Parameters
textThe text to be written.

◆ writeln()

writeln ( String  text)

Writes the specified text and an end-of-line.

Parameters
textThe text to be written.


Generated by Autodesk, Inc. 19 April 2024
Copyright (c) 2012-2024 by Autodesk, Inc.