Package com.inductiveautomation.rm.base
Class RMFileUtils
java.lang.Object
com.inductiveautomation.rm.base.RMFileUtils
Utility methods for file.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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- 
RMFileUtilspublic RMFileUtils()
 
- 
- 
Method Details- 
getFileReturns a File object from a source, if one can be divined.
- 
getPathReturns the path for a file.
- 
getFileNameReturns the file name for a file.
- 
getFileNameSimpleReturns the file name for a file.
- 
getFileExtensionReturns the file name for a file.
- 
isFileTypeReturns whether file is given type.
- 
getDirectoryReturns a child directory for a parent directory, creating if necessary.
- 
openFileTries to open the given file name with the platform reader.
- 
openFileTries to open the given file name with the platform reader.
- 
getBytesReturns bytes for a file.
- 
writeBytesWrites the given bytes (within the specified range) to the given file.- Throws:
- IOException
 
- 
writeBytesSafelyWrites the given bytes (within the specified range) to the given file, with an option for doing it "safely".- Throws:
- IOException
 
- 
getTempDirReturns the temp directory.
- 
getTempFileCreates a file in the temp directory.
- 
getUserHomeDirReturns a file for named directory in the user's home directory (with option to create).
- 
getAppDataDirReturns the AppData or Application Support directory file.
- 
copyFileCopies a file from one location to another.- Throws:
- IOException
 
- 
copyFileSafeCopies a file from one location to another with exception suppression.
- 
deleteDeepDeletes a directory.
- 
unzipUnzips the given file into the destination file.
- 
getUnpackDestinationReturns the file that given packed file would be saved to using the unpack method.
- 
getUniqueFileReturns a unique non-existent file for given file.
 
-