File

Description

Functions to support general file IO operations

Functions

NameSignature and Synopsis
createFolderboolean createFolder(String directoryPath, String folderName)
Creates a folder on the file system
createFoldersboolean createFolders(String directoryPath, String folderPath)
Creates a folder structure on the file system under the path specified by directory path
fileClosevoid fileClose (Object writerReader)
Closes the file that was previously opened with File.openFile().
fileExistsboolean fileExists (String path)
Tests whether the file or directory denoted by the specified path exists.
fileLengthlong fileLength (Object writerReader)
Returns the length of the specified file (in bytes).
fileReadLineString fileReadLine (Object fileReader)
Reads from the file pointer until the first instance of , , or the end of the file. Each byte of the input is converted in sequence into the low bytes of one character in the result. The line ending is not included in the result.
fileRemoveboolean fileRemove (String path)
Deletes the specified file or directory.
fileRenameboolean fileRename (String srcPath, String destPath)
Renames the specified file or directory.
fileSeekvoid fileSeek (Object writerReader, long pos)
Set the file-pointer offset (in bytes) at which the next IO will occur.
fileTruncateAndWritevoid fileTruncateAndWrite(Object fileWriter, Object byteContents)
Truncate existing file and write any new contents.
fileWritevoid fileWrite (Object fileWriter, String str)
Writes the low byte of each character in the String in sequence to the file.
fileWriteBytesvoid fileWrite (Object fileWriter, Object bytes)
Writes a byte[] to the file.
fileWriteLinevoid fileWriteLine (Object fileWriter, String str)
Writes the low byte of each character in the String to the file in sequence, followed by the system-specific line separator.
listFilesString[] listFiles (String dirPath, String filter)
Returns an array of files from the target directory that match the specified filter/pattern.
openFileObject openFile (String path, String mode)
Open the specified file for reading, and optionally, writing.
readFileAsBytesObject readFileAsBytes (String filePath)
Read the contents of the specified file and return a byte[]
readFileAsStringString readFileAsString(String filePath, [String encoding = $1UTF-8$1])
Read the contents of the specified file and return a string