qie.readFile¶
Signature: qie.readFile(file)
Returns: byte[] fileBytes - the contents of the file
Read a file.
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| String, File, or NetFile | file | the file to read. This can be either a string representing the file's full path and file name (i.e. 'c:\\temp\\file.txt'), a java.io.File object or a com.qvera.qie.utils.NetFile object. |
Example¶
// Read File examples:
// Example: file as String path
qie.writeFile("/tmp/mine.txt", "Sample text.", true);
var fileContents = qie.readFile("/tmp/mine.txt");
// fileContents contains the contents of the file
// Example: file as java.io.File
var fileObject = qie.newFile("/tmp/mine-file.txt"); // java.io.File
qie.writeFile(fileObject, "Sample text written using a File object.", true);
var fileContentsFromFileObject = qie.readFile(fileObject);
// fileContentsFromFileObject contains the contents of the file