Package com.inductiveautomation.rm.base
Class RMFileUtils
- java.lang.Object
- 
- com.inductiveautomation.rm.base.RMFileUtils
 
- 
 public class RMFileUtils extends java.lang.ObjectUtility methods for file.
- 
- 
Constructor SummaryConstructors Constructor Description RMFileUtils()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static java.io.FilecopyFile(java.io.File aSource, java.io.File aDest)Copies a file from one location to another.static java.io.FilecopyFileSafe(java.io.File in, java.io.File out)Copies a file from one location to another with exception suppression.static booleandeleteDeep(java.io.File aFile)Deletes a directory.static java.io.FilegetAppDataDir(java.lang.String aName, boolean doCreate)Returns the AppData or Application Support directory file.static byte[]getBytes(java.io.File aFile)Returns bytes for a file.static java.io.FilegetDirectory(java.io.File aParent, java.lang.String aChild, boolean create)Returns a child directory for a parent directory, creating if necessary.static java.io.FilegetFile(java.lang.Object aSource)Returns a File object from a source, if one can be divined.static java.lang.StringgetFileExtension(java.io.File aFile)Returns the file name for a file.static java.lang.StringgetFileName(java.io.File aFile)Returns the file name for a file.static java.lang.StringgetFileNameSimple(java.io.File aFile)Returns the file name for a file.static java.lang.StringgetPath(java.io.File aFile)Returns the path for a file.static java.io.FilegetTempDir()Returns the temp directory.static java.io.FilegetTempFile(java.lang.String aName)Creates a file in the temp directory.static java.io.FilegetUniqueFile(java.io.File aFile)Returns a unique non-existent file for given file.static java.io.FilegetUnpackDestination(java.io.File aFile, java.io.File aDestFile)Returns the file that given packed file would be saved to using the unpack method.static java.io.FilegetUserHomeDir(java.lang.String aName, boolean doCreate)Returns a file for named directory in the user's home directory (with option to create).static booleanisFileType(java.io.File aFile, java.lang.String... theTypes)Returns whether file is given type.static voidopenFile(java.io.File aFile)Tries to open the given file name with the platform reader.static voidopenFile(java.lang.String aName)Tries to open the given file name with the platform reader.static voidunzip(java.io.File aFile)Unzips the given file into the destination file.static voidwriteBytes(java.io.File aFile, byte[] theBytes)Writes the given bytes (within the specified range) to the given file.static voidwriteBytesSafely(java.io.File aFile, byte[] theBytes)Writes the given bytes (within the specified range) to the given file, with an option for doing it "safely".
 
- 
- 
- 
Method Detail- 
getFilepublic static java.io.File getFile(java.lang.Object aSource) Returns a File object from a source, if one can be divined.
 - 
getPathpublic static java.lang.String getPath(java.io.File aFile) Returns the path for a file.
 - 
getFileNamepublic static java.lang.String getFileName(java.io.File aFile) Returns the file name for a file.
 - 
getFileNameSimplepublic static java.lang.String getFileNameSimple(java.io.File aFile) Returns the file name for a file.
 - 
getFileExtensionpublic static java.lang.String getFileExtension(java.io.File aFile) Returns the file name for a file.
 - 
isFileTypepublic static boolean isFileType(java.io.File aFile, java.lang.String... theTypes)Returns whether file is given type.
 - 
getDirectorypublic static java.io.File getDirectory(java.io.File aParent, java.lang.String aChild, boolean create)Returns a child directory for a parent directory, creating if necessary.
 - 
openFilepublic static void openFile(java.io.File aFile) Tries to open the given file name with the platform reader.
 - 
openFilepublic static void openFile(java.lang.String aName) Tries to open the given file name with the platform reader.
 - 
getBytespublic static byte[] getBytes(java.io.File aFile) Returns bytes for a file.
 - 
writeBytespublic static void writeBytes(@Nonnull java.io.File aFile, @Nullable byte[] theBytes) throws java.io.IOExceptionWrites the given bytes (within the specified range) to the given file.- Throws:
- java.io.IOException
 
 - 
writeBytesSafelypublic static void writeBytesSafely(java.io.File aFile, byte[] theBytes) throws java.io.IOExceptionWrites the given bytes (within the specified range) to the given file, with an option for doing it "safely".- Throws:
- java.io.IOException
 
 - 
getTempDirpublic static java.io.File getTempDir() Returns the temp directory.
 - 
getTempFilepublic static java.io.File getTempFile(java.lang.String aName) Creates a file in the temp directory.
 - 
getUserHomeDirpublic static java.io.File getUserHomeDir(java.lang.String aName, boolean doCreate)Returns a file for named directory in the user's home directory (with option to create).
 - 
getAppDataDirpublic static java.io.File getAppDataDir(java.lang.String aName, boolean doCreate)Returns the AppData or Application Support directory file.
 - 
copyFilepublic static java.io.File copyFile(java.io.File aSource, java.io.File aDest) throws java.io.IOExceptionCopies a file from one location to another.- Throws:
- java.io.IOException
 
 - 
copyFileSafepublic static java.io.File copyFileSafe(java.io.File in, java.io.File out)Copies a file from one location to another with exception suppression.
 - 
deleteDeeppublic static boolean deleteDeep(java.io.File aFile) Deletes a directory.
 - 
unzippublic static void unzip(java.io.File aFile) Unzips the given file into the destination file.
 - 
getUnpackDestinationpublic static java.io.File getUnpackDestination(java.io.File aFile, java.io.File aDestFile)Returns the file that given packed file would be saved to using the unpack method.
 - 
getUniqueFilepublic static java.io.File getUniqueFile(java.io.File aFile) Returns a unique non-existent file for given file.
 
- 
 
-