|
File & | setPath (const String &path) |
| Specify absolute path of this image file. Name of file can not be changed if there is an open stream. More...
|
|
String | path () const |
| Retrieves the full file path. More...
|
|
File & | setExtension (const String &ext) |
| Change extension for file name. Extension won't change if there is an open stream. More...
|
|
String | extension () const |
| Retrieve file extension. More...
|
|
bool | exists () const |
| Verify if file exists on the disk. More...
|
|
bool | remove () |
| Remove physical file manually. Cannot remove file if there is an open stream. More...
|
|
void | setTextCodec (const String &codecName) |
| Sets the codec for this file wrapper for the encoding specified by codecName. Common values for codecName include "ISO 8859-1", "UTF-8", and "UTF-16". More...
|
|
|
bool | isOpen () const |
| Check if file is opened. More...
|
|
bool | isClose () const |
| Checks if the file is closed. More...
|
|
bool | open (int m=int(IO::WRITE_ONLY)) |
| Opens the file stream for read/write. More...
|
|
bool | close () |
| Closes the file stream. More...
|
|
void | write (const String &text) |
| Write string in current stream. More...
|
|
void | writeLine (const String &text) |
| Write string line in current stream. More...
|
|
void | writeFile (File file) |
| Write entire contents of the parameter file in the current stream. More...
|
|
String | read () |
| Read entire content of stream. More...
|
|
String | readLine () |
| Read single line of stream. More...
|
|
|
bool | move (File dest) |
| Moves the current File to a new File destination. More...
|
|
bool | copy (File dest) |
| Copy current File to new File destination. More...
|
|
The PermanentFile and TemporaryFile JavaScript classes. Used to represent an actual image file on disk.
Files can be instantiated in the scripting environment or retrieved in an InputPort object.
There are two possible constructors: the PermanentFile or TemporaryFile. The PermanentFile takes the name of a file as an argument.
file = new PermanentFile( "C:\file.txt" );
file.writeLine( "Hello World!" );
file.close();
The TemporaryFile takes an extension as an argument, an returns a temporary file with that extension. The temporary file and its containing directory will be deleted on exit.
file = new TemporaryFile( "txt" );
file.writeLine( "Hello World!" );
file.close();