Package com.inductiveautomation.rm.base
Class RMFileUtils
java.lang.Object
com.inductiveautomation.rm.base.RMFileUtils
Utility methods for file.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic File
Copies a file from one location to another.static File
copyFileSafe
(File in, File out) Copies a file from one location to another with exception suppression.static boolean
deleteDeep
(File aFile) Deletes a directory.static File
getAppDataDir
(String aName, boolean doCreate) Returns the AppData or Application Support directory file.static byte[]
Returns bytes for a file.static File
getDirectory
(File aParent, String aChild, boolean create) Returns a child directory for a parent directory, creating if necessary.static File
Returns a File object from a source, if one can be divined.static String
getFileExtension
(File aFile) Returns the file name for a file.static String
getFileName
(File aFile) Returns the file name for a file.static String
getFileNameSimple
(File aFile) Returns the file name for a file.static String
Returns the path for a file.static File
Returns the temp directory.static File
getTempFile
(String aName) Creates a file in the temp directory.static File
getUniqueFile
(File aFile) Returns a unique non-existent file for given file.static File
getUnpackDestination
(File aFile, File aDestFile) Returns the file that given packed file would be saved to using the unpack method.static File
getUserHomeDir
(String aName, boolean doCreate) Returns a file for named directory in the user's home directory (with option to create).static boolean
isFileType
(File aFile, String... theTypes) Returns whether file is given type.static void
Tries to open the given file name with the platform reader.static void
Tries to open the given file name with the platform reader.static void
Unzips the given file into the destination file.static void
writeBytes
(File aFile, byte[] theBytes) Writes the given bytes (within the specified range) to the given file.static void
writeBytesSafely
(File aFile, byte[] theBytes) Writes the given bytes (within the specified range) to the given file, with an option for doing it "safely".
-
Constructor Details
-
RMFileUtils
public RMFileUtils()
-
-
Method Details
-
getFile
Returns a File object from a source, if one can be divined. -
getPath
Returns the path for a file. -
getFileName
Returns the file name for a file. -
getFileNameSimple
Returns the file name for a file. -
getFileExtension
Returns the file name for a file. -
isFileType
Returns whether file is given type. -
getDirectory
Returns a child directory for a parent directory, creating if necessary. -
openFile
Tries to open the given file name with the platform reader. -
openFile
Tries to open the given file name with the platform reader. -
getBytes
Returns bytes for a file. -
writeBytes
Writes the given bytes (within the specified range) to the given file.- Throws:
IOException
-
writeBytesSafely
Writes the given bytes (within the specified range) to the given file, with an option for doing it "safely".- Throws:
IOException
-
getTempDir
Returns the temp directory. -
getTempFile
Creates a file in the temp directory. -
getUserHomeDir
Returns a file for named directory in the user's home directory (with option to create). -
getAppDataDir
Returns the AppData or Application Support directory file. -
copyFile
Copies a file from one location to another.- Throws:
IOException
-
copyFileSafe
Copies a file from one location to another with exception suppression. -
deleteDeep
Deletes a directory. -
unzip
Unzips the given file into the destination file. -
getUnpackDestination
Returns the file that given packed file would be saved to using the unpack method. -
getUniqueFile
Returns a unique non-existent file for given file.
-