| DAZ Script | |
|---|---|
| FileError | { NoError, ReadError, WriteError, FatalError, ResourceError, OpenError, AbortError, TimeOutError, UnspecifiedError, RemoveError, RenameError, PositionError, ResizeError, PermissionsError, CopyError } |
| OpenModeFlag | { NotOpen, ReadOnly, WriteOnly, ReadWrite, Append, Truncate, Text, Translate } |
| DAZ Script | |
|---|---|
| void | close () |
| Boolean | copy ( String newName ) |
| Boolean | eof () |
| FileError | error () |
| String | errorString () |
| Boolean | isOpen () |
| Boolean | isTextModeEnabled () |
| Boolean | link ( String linkName ) |
| Boolean | open ( OpenMode mode ) |
| OpenMode | openMode () |
| ByteArray | peek ( Number maxSize ) |
| Number | pos () |
| ByteArray | read ( Number maxSize ) |
| String | read () |
| ByteArray | readAll () |
| Number | readByte () |
| ByteArray | readByteLine ( Number maxSize=0 ) |
| String | readLine () |
| Array | readLines () |
| Boolean | rename ( String newName ) |
| Boolean | reset () |
| Boolean | seek ( Number pos ) |
| void | setFileName ( String name ) |
| Boolean | setPermissions ( Permissions permissions ) |
| void | setTextModeEnabled ( Boolean enabled ) |
| Number | write ( String data, Number maxSize=-1 ) |
| void | writeByte ( Number byte ) |
| Number | writeBytes ( ByteArray byteArray ) |
| void | writeLine ( String data ) |
| void | writeLineUtf8 ( String data ) |
| Number | writeUtf8 ( String data, Number length=-1 ) |
Provides access for reading and writing files.
TODO: Add description.
—–
Enumerated values used with open() to describe the mode in which a file is opened.
'. When writing, the end-of-line terminators are translated to the local encoding.
Creates a file object with the given file name.
Parameter(s):
void : close()
Closes the file, sets its openMode() to NotOpen, and resets the error string.
Boolean : copy( String newName )
Parameter(s):
Return Value:
true if copying the file is successful, otherwise false.Attention:
newName already exists it will not be overwritten.Return Value:
true if the current position is at the end of the file, otherwise false.Return Value:
Attention:
false, or a read/write operation returns -1, this function can be called to find out the reason why the operation failed.Since:
String : errorString()
Return Value:
Since:
Return Value:
true if the file is open, otherwise false.Since:
Return Value:
true if the Text OpenModeFlag is enabled, otherwise false.Since:
Boolean : link( String linkName )
Creates a link named linkName that points to the file currently specified by fileName(). What a link is depends on the underlying filesystem (be it a shortcut on Windows or a symbolic link on Mac OS X).
Return Value:
true if successful, otherwise false.Attention:
Since:
Renames the file currently specified by fileName() to newName.
Return Value:
true if successful, otherwise false (for example, if a file with the name newName already exists).Attention:
Since:
Boolean : open( OpenMode mode )
Opens the file and sets its openMode() to mode.
Parameter(s):
Return Value:
true if the file was opened successfully, otherwise false.OpenMode : openMode()
Return Value:
Since:
ByteArray : peek( Number maxSize )
Peeks at most maxSize bytes from the file, without side effects (i.e., if you read after you peek, you will get the same data).
Return Value:
Since:
Return Value:
Since:
ByteArray : read( Number maxSize )
Reads at most maxSize bytes from the file.
Return Value:
Since:
Read the entire file.
Return Value:
Read the entire file.
Return Value:
Attention:
Read one character from the file.
Return Value:
ByteArray : readByteLine( Number maxSize=0 )
Reads a line from the file, but no more than maxSize characters.
Parameter(s):
Return Value:
Attention:
Read a line of text from the file.
Return Value:
Read the entire file and split it into lines of text.
Return Value:
Boolean : rename( String newName )
TODO: Add description.
Seeks to the start of input.
Return Value:
true on success, otherwise false (for example, if the file is not open).Since:
Sets the current position to pos.
Return Value:
true on success, otherwise false.Since:
void : setFileName( String name )
Sets the name of the file to name. The name can have no path, a relative path, or an absolute path.
Attention:
Since:
Boolean : setPermissions( Permissions permissions )
Sets the permissions for the file to permissions.
Return Value:
true if successful, otherwise false (for example, if the permissions cannot be modified).Since:
void : setTextModeEnabled( Boolean enabled )
If enabled is true, sets the Text flag on the file, otherwise the Text flag is removed.
Since:
Number : write( String data, Number maxSize=-1 )
Write a string to the file.
Parameter(s):
Return Value:
void : writeByte( Number byte )
Write a single byte (character) to the file.
Parameter(s):
Number : writeBytes( ByteArray byteArray )
Writes the content of byteArray to the file.
Return Value:
Since:
void : writeLine( String data )
Write a line to the file.
Parameter(s):
void : writeLineUtf8( String data )
Write a UTF-8 line to file.
Parameter(s):
Since:
Number : writeUtf8( String data, Number length=-1 )
Write a UTF-8 string to file.
Parameter(s):
Return Value:
Since: