Class FileUtilities
java.lang.Object
com.inductiveautomation.ignition.common.script.builtin.FileUtilities
Functions for file system access, exposed as system.file.*.
These functions are available platform-wide.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanfileExists(String filename) static StringgetTempFile(String extension) static byte[]readFileAsBytes(String filename) static StringreadFileAsString(String filename) static StringreadFileAsString(String filename, String encoding) Reads the entire content of a file as a string.static voidstatic voidstatic voidstatic voidstatic voidWrites data to a file.
-
Field Details
-
US_ASCII
-
ISO_8859_1
-
UTF_8
-
UTF_16BE
-
UTF_16LE
-
UTF_16
-
-
Constructor Details
-
FileUtilities
public FileUtilities()
-
-
Method Details
-
getTempFile
-
fileExists
-
writeFile
-
writeFile
-
writeFile
-
writeFile
-
writeFile
Writes data to a file.If the file or its parent directories do not exist, they will be created.
- Parameters:
filename- The path to the file to write to.data- The string data to write.append- If true, the data will be appended to the end of the file instead of overwriting.encoding- The character encoding to use (e.g., "UTF-8"). If omitted, the platform default is used.- Throws:
org.python.core.PyException- withIOErrorif an error occurs during writing.
-
readFileAsString
-
readFileAsString
Reads the entire content of a file as a string.- Parameters:
filename- The path to the file to read.encoding- The character encoding to use (e.g., "UTF-8"). If omitted, the platform default is used.- Returns:
- The content of the file as a string.
- Throws:
org.python.core.PyException- withIOErrorif the file cannot be read.
-
readFileAsBytes
-