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 FileCopies a file from one location to another.static FilecopyFileSafe(File in, File out) Copies a file from one location to another with exception suppression.static booleandeleteDeep(File aFile) Deletes a directory.static FilegetAppDataDir(String aName, boolean doCreate) Returns the AppData or Application Support directory file.static byte[]Returns bytes for a file.static FilegetDirectory(File aParent, String aChild, boolean create) Returns a child directory for a parent directory, creating if necessary.static FileReturns a File object from a source, if one can be divined.static StringgetFileExtension(File aFile) Returns the file name for a file.static StringgetFileName(File aFile) Returns the file name for a file.static StringgetFileNameSimple(File aFile) Returns the file name for a file.static StringReturns the path for a file.static FileReturns the temp directory.static FilegetTempFile(String aName) Creates a file in the temp directory.static FilegetUniqueFile(File aFile) Returns a unique non-existent file for given file.static FilegetUnpackDestination(File aFile, File aDestFile) Returns the file that given packed file would be saved to using the unpack method.static FilegetUserHomeDir(String aName, boolean doCreate) Returns a file for named directory in the user's home directory (with option to create).static booleanisFileType(File aFile, String... theTypes) Returns whether file is given type.static voidTries to open the given file name with the platform reader.static voidTries to open the given file name with the platform reader.static voidUnzips the given file into the destination file.static voidwriteBytes(File aFile, byte[] theBytes) Writes the given bytes (within the specified range) to the given file.static voidwriteBytesSafely(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.
-