- TIBCO BusinessEvents®
- Standard
- File

# File

## Description

Functions to support general file IO operations

## Functions

Name | Signature and Synopsis
--- | ---
`createFolder` | `boolean createFolder(String directoryPath, String folderName)` Creates a folder on the file system
`createFolders` | `boolean createFolders(String directoryPath, String folderPath)` Creates a folder structure on the file system under the path specified by directory path
`fileClose` | `void fileClose (Object writerReader)` Closes the file that was previously opened with File.openFile().
`fileExists` | `boolean fileExists (String path)` Tests whether the file or directory denoted by the specified path exists.
`fileLength` | `long fileLength (Object writerReader)` Returns the length of the specified file (in bytes).
`fileReadLine` | `String 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.
`fileRemove` | `boolean fileRemove (String path)` Deletes the specified file or directory.
`fileRename` | `boolean fileRename (String srcPath, String destPath)` Renames the specified file or directory.
`fileSeek` | `void fileSeek (Object writerReader, long pos)` Set the file-pointer offset (in bytes) at which the next IO will occur.
`fileTruncateAndWrite` | `void fileTruncateAndWrite(Object fileWriter, Object byteContents)` Truncate existing file and write any new contents.
`fileWrite` | `void fileWrite (Object fileWriter, String str)` Writes the low byte of each character in the String in sequence to the file.
`fileWriteBytes` | `void fileWrite (Object fileWriter, Object bytes)` Writes a `byte[]` to the file.
`fileWriteLine` | `void 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.
`listFiles` | `String[] listFiles (String dirPath, String filter)` Returns an array of files from the target directory that match the specified filter/pattern.
`openFile` | `Object openFile (String path, String mode)` Open the specified file for reading, and optionally, writing.
`readFileAsBytes` | `Object readFileAsBytes (String filePath)` Read the contents of the specified file and return a byte[]
`readFileAsString` | `String readFileAsString(String filePath, [String encoding = $1UTF-8$1])` Read the contents of the specified file and return a string