File
Description
The File class provides many common file operations for text and binary files.
API overview
Constructor
File
()
Functions
Public functions
| copy ( pathSource: String , pathDestination: String ): Boolean |
static Copies a file from pathSource to pathDestination Please note that this implementation requires the file be loaded into memory |
| fileExists ( path: String ): Boolean |
static Checks whether a file exists at the given path |
| loadBinaryFile ( path: String ): ByteArray |
static Loads a binary file from the given file path |
| loadTextFile ( path: String ): String |
static Loads a text file from the given file path |
| move ( pathSource: String , pathDestination: String ): Boolean |
static Moves a file from pathSource to pathDestination |
| removeFile ( path: String ): Boolean |
static Removes a file at the given path |
| writeBinaryFile ( path: String , data: ByteArray ): Boolean |
static Writes a binary file to the given file path |
| writeTextFile ( path: String , text: String ): Boolean |
static Writes a text file to the given file path |
Constructor
File ()
Functions
copy ( pathSource: String , pathDestination: String ): Boolean
static
Copies a file from pathSource to pathDestination
Please note that this implementation requires the file be loaded into memory. Therefore, it must fit into available memory.
Parameters
| pathSource: String | The source file to copy. |
| pathDestination: String | The destination file to write to. |
Returns
| Boolean | True on success, false on failure. |
fileExists ( path: String ): Boolean
static
Checks whether a file exists at the given path.
Parameters
| path: String | The full path to the file to check. |
Returns
| Boolean | True if the file exists, false if it doesn't. |
getFullTypeName
(): String
Inherited from Object
native
Gets the fully qualified type name of the Object. The fully qualified type name includes the package of the type.
Returns
| String | fully qualified type name of the Object. |
getType
(): Type
Inherited from Object
native
Gets the Type that describes the Object.
Returns
| Type | The Type that describes the object. |
getTypeName
(): String
Inherited from Object
native
Gets the type name of the Object.
Returns
| String | type name of the Object. |
loadBinaryFile ( path: String ): ByteArray
static
Loads a binary file from the given file path.
Parameters
| path: String | The full path to the binary file to load. |
Returns
| ByteArray | ByteArray with the contents of the binary file or null if the file can't be loaded. |
loadTextFile ( path: String ): String
static
Loads a text file from the given file path.
Parameters
| path: String | The full path to the text file to load. |
Returns
| String | A String with the contents of the text file or null if the file can't be loaded. |
move ( pathSource: String , pathDestination: String ): Boolean
static
Moves a file from pathSource to pathDestination
Parameters
| pathSource: String | The source file to move. |
| pathDestination: String | The destination path to move the file to. |
Returns
| Boolean | True on success, false on failure. |
removeFile ( path: String ): Boolean
static
Removes a file at the given path.
Parameters
| path: String | The full path of the file to be removed. |
Returns
| Boolean | True on success, false on failure. |
toString
(): String
Inherited from Object
native
Returns a String that describes the Object. This can be overriden to provide extra details when printing objects using trace().
Returns
| String | String that described the Object. |
writeBinaryFile ( path: String , data: ByteArray ): Boolean
static
Writes a binary file to the given file path.
Parameters
| path: String | The full path to the binary file to save. |
| data: ByteArray | The ByteArray containing the data to write to the file. |
Returns
| Boolean | True on success, false on failure. |