public final class FileUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
appendData(java.io.File file,
byte[] data,
int offset,
int count)
Appends some binary data to a file.
|
static void |
appendData(java.lang.String fileAbsPath,
byte[] data,
int offset,
int count)
Appends some binary data to a file in the specified path.
|
static void |
appendText(java.io.File file,
java.lang.String text)
Appends some text to a file.
|
static void |
appendText(java.io.File file,
java.lang.String text,
java.lang.String eolTerminator)
Appends some text to a file in the specified path.
|
static void |
appendText(java.lang.String fileAbsPath,
java.lang.String text)
Appends some text to a file in the specified path.
|
static void |
appendText(java.lang.String fileAbsPath,
java.lang.String text,
java.lang.String eolTerminator)
Appends some text to a file in the specified path.
|
static void |
appendTextLine(java.io.File file,
java.lang.String text)
Appends some text to a file and then appends Environment.NewLine.
|
static void |
appendTextLine(java.lang.String fileAbsPath,
java.lang.String text)
Appends some text to a file in the specified path and then appends Environment.NewLine.
|
static void |
cloneFile(java.io.File originatingFile,
java.lang.String destinationPath)
Copies a file from source to destination while preserving the file's Last Modified date.
|
static void |
cloneFile(java.lang.String originatingPath,
java.lang.String destinationPath)
Copies a file from source to destination while preserving the file's Last Modified date.
|
static java.lang.String |
combinePath(java.lang.String path,
java.lang.String nextPath)
Combines two paths, appending a directory separator after the first path, if needed.
|
static void |
copyFile(java.io.File originatingFile,
java.lang.String destinationPath)
Copies a file from source to destination
|
static void |
copyFile(java.lang.String originatingPath,
java.lang.String destinationPath)
Copies a file from source to destination
|
static void |
createApplicationShortcut(java.lang.String shortcutAbsPath,
java.lang.String linkedResourceAbsPath)
On Win32/Linux, creates a shortcut to a file or folder (use overloaded version for linking to an application).
|
static void |
createApplicationShortcut(java.lang.String shortcutAbsPath,
java.lang.String linkedResourceAbsPath,
java.lang.String applicationWorkingDirectory)
On Win32/Linux, creates a shortcut to a file, folder or application (if an application working dir is specified).
|
static void |
createDirectory(java.io.File dirAbsPath)
Creates a directory if it does not already exist (if there are subdirectories there are created too).
|
static void |
createDirectory(java.lang.String dirAbsPath)
Creates a directory if it does not already exist (if there are subdirectories there are created too).
|
static void |
createInternetShortcut(java.lang.String shortcutAbsPath,
java.lang.String url)
Creates a URL shortcut.
|
static void |
deleteDirectory(java.io.File dirAbsPath)
Deletes an empty directory, if it exists.
|
static void |
deleteDirectory(java.lang.String dirAbsPath)
Deletes an empty directory, if it exists.
|
static void |
deleteDirectoryRecursive(java.io.File dirAbsPath)
Deletes a directory recursively (if there are contents they will be deleted).
|
static void |
deleteDirectoryRecursive(java.lang.String dirAbsPath)
Deletes a directory recursively (if there are contents they will be deleted).
|
static void |
deleteFile(java.io.File file)
Deletes a file, if it exists.
|
static void |
deleteFile(java.lang.String fileAbsPath)
Deletes a file, if it exists.
|
static boolean |
exists(java.io.File file)
Returns true if the file exists
|
static boolean |
exists(java.lang.String file)
Returns true if the file exists
|
static java.io.File[] |
filterIn(java.io.File[] files,
java.util.Set<FileAttribute> fileAttributes)
Filters out files/directories which do not have the specified attributes.
|
static java.io.File[] |
filterOut(java.io.File[] files,
java.util.Set<FileAttribute> fileAttributes)
Filters out files/directories which have the specified attributes.
|
static java.lang.String |
getFileExtension(java.io.File file)
Returns the specified file's extension, or an empty string if no extension was found
|
static java.lang.String |
getFileExtension(java.lang.String filename)
Returns the specified file's extension, or an empty string if no extension was found
|
static java.lang.String |
getFileName(java.io.File file)
Trims the file's extension (if there is one) and returns the file name
|
static java.lang.String |
getFileName(java.lang.String filename)
Trims the file's extension (if there is one) and returns the file name
|
static byte[] |
getResourceData(java.net.URL url)
Returns the data of the specified URL.
|
static java.io.InputStream |
getResourceStreamData(java.net.URL url)
Returns an input stream to the specified resource.
|
static java.lang.String |
getResourceTextData(java.net.URL url)
Returns the text data of the specified URL.
|
static java.lang.String |
getResourceTextData(java.net.URL url,
java.nio.charset.Charset charset)
Returns the text data of the specified URL.
|
static java.net.URL |
getResourceUrl(java.lang.Package pkg,
java.lang.String filename)
Returns the URL to a resource, by its package and name e.g.
|
static java.net.URL |
getResourceUrl(java.lang.String classpath)
Returns the URL to a resource, by its class path e.g.
|
static boolean |
isDirectory(java.io.File file)
Returns true if the File is a directory
|
static boolean |
isDirectory(java.lang.String file)
Returns true if the File is a directory
|
static boolean |
isFile(java.io.File file)
Returns true if the File is not a directory
|
static boolean |
isFile(java.lang.String file)
Returns true if the File is not a directory
|
static boolean |
moveFile(java.io.File originatingFile,
java.lang.String destinationPath)
Moves a file from source to destination
|
static boolean |
moveFile(java.lang.String originatingPath,
java.lang.String destinationPath)
Moves a file from source to destination
|
static void |
performCreateReadWriteDeleteAccess(java.lang.String folderName)
Tests access rights on a folder.
|
static byte[] |
readFileInMemory(java.io.File file)
Reads the entire contents of a file to a byte[] and returns it.
|
static byte[] |
readFileInMemory(java.lang.String fileAbsPath)
Reads the entire contents of a file to a byte[] and returns it.
|
static java.lang.Iterable<byte[]> |
readFilePerBlock(java.io.File file,
int blockSize)
Enumerates the contents of a file line by line (reads the entire contents of a file in memory to do so).
|
static java.lang.Iterable<byte[]> |
readFilePerBlock(java.lang.String fileAbsPath,
int blockSize)
Enumerates the contents of a file line by line (reads the entire contents of a file in memory to do so).
|
static java.lang.Iterable<java.lang.String> |
readFilePerLine(java.io.File file)
Enumerates the contents of a file line by line (reads the entire contents of a file in memory to do so).
|
static java.lang.Iterable<java.lang.String> |
readFilePerLine(java.lang.String fileAbsPath)
Enumerates the contents of a file line by line.
|
static java.lang.String |
readFileToEnd(java.io.File file)
Reads the entire contents of a file to a string and returns it.
|
static java.lang.String |
readFileToEnd(java.lang.String fileAbsPath)
Reads the entire contents of a file to a string and returns it.
|
static java.util.List<java.lang.String> |
scanPath(java.lang.String path,
ScanInclusionMode inclusionMode,
ScanHiddenMode hiddenMode,
ScanDepthMode depthMode,
ScanSortMode sortMode,
ScanFailMode failMode)
Scans a directory path for files and folders, using the specified configuration.
|
static java.util.List<java.lang.String> |
scanPath(java.lang.String path,
ScanInclusionMode inclusionMode,
ScanHiddenMode hiddenMode,
ScanDepthMode depthMode,
ScanSortMode sortMode,
ScanFailMode failMode,
java.util.List<ScanErrorEntry> collectedScanErrors)
Scans a directory path for files and folders, using the specified configuration.
|
static void |
touchDirectory(java.io.File dirAbsPath)
Touches a directory, i.e.
|
static void |
touchDirectory(java.lang.String dirAbsPath)
Touches a directory, i.e.
|
static void |
touchFile(java.io.File file)
Touches a file, i.e.
|
static void |
touchFile(java.lang.String fileAbsPath)
Touches a file, i.e.
|
static boolean |
tryCloneFile(java.io.File sourceFile,
java.lang.String destAbsPath)
Clones a file from source to destination, returning true if the operation was successful.
|
static boolean |
tryCloneFile(java.lang.String sourceAbsPath,
java.lang.String destAbsPath)
Clones a file from source to destination, returning true if the operation was successful.
|
static boolean |
tryCopyFile(java.io.File sourceFile,
java.lang.String destAbsPath)
Copies a file from source to destination, returning true if the operation was successful.
|
static boolean |
tryCopyFile(java.lang.String sourceAbsPath,
java.lang.String destAbsPath)
Copies a file from source to destination, returning true if the operation was successful.
|
static boolean |
tryCreateDirectory(java.io.File dirAbsPath)
Attempts to create a directory (if there are subdirectories there are created too).
|
static boolean |
tryCreateDirectory(java.lang.String dirAbsPath)
Attempts to create a directory (if there are subdirectories there are created too).
|
static boolean |
tryDeleteDirectory(java.io.File dirAbsPath)
Attempts to delete an empty directory (if there are contents this will not succeed).
|
static boolean |
tryDeleteDirectory(java.lang.String dirAbsPath)
Attempts to delete an empty directory (if there are contents this will not succeed).
|
static boolean |
tryDeleteDirectoryRecursive(java.io.File dirAbsPath)
Attempts to delete a directory (if there are contents they will be deleted).
|
static boolean |
tryDeleteDirectoryRecursive(java.lang.String dirAbsPath)
Attempts to delete a directory (if there are contents they will be deleted).
|
static boolean |
tryDeleteFile(java.io.File file)
Attempts to delete a file.
|
static boolean |
tryDeleteFile(java.lang.String fileAbsPath)
Attempts to delete a file.
|
static boolean |
tryMoveFile(java.io.File sourceFile,
java.lang.String destAbsPath)
Moves a file from source to destination, returning true if the operation was successful.
|
static boolean |
tryMoveFile(java.lang.String sourceAbsPath,
java.lang.String destAbsPath)
Moves a file from source to destination, returning true if the operation was successful.
|
static boolean |
tryPerformCreateReadWriteDeleteAccess(java.lang.String folderName)
Tests access rights on a folder and returns true if these succeed, otherwise returns false.
|
static boolean |
tryTouchDirectory(java.io.File dirAbsPath)
Touches a directory, i.e.
|
static boolean |
tryTouchDirectory(java.lang.String dirAbsPath)
Touches a directory, i.e.
|
static boolean |
tryTouchFile(java.io.File file)
Touches a file, i.e.
|
static boolean |
tryTouchFile(java.lang.String fileAbsPath)
Touches a file, i.e.
|
public static void appendData(java.io.File file, byte[] data, int offset, int count) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.lang.IllegalArgumentException
- An argument is out of rangejava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file specified is a directory, or it does not exist and cannot be created, or cannot be appended to.java.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static void appendData(java.lang.String fileAbsPath, byte[] data, int offset, int count) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.lang.IllegalArgumentException
- An argument is out of rangejava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file specified is a directory, or it does not exist and cannot be created, or cannot be appended to.java.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static void appendText(java.io.File file, java.lang.String text) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.lang.IllegalArgumentException
- An argument is out of rangejava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file specified is a directory, or it does not exist and cannot be created, or cannot be appended to.java.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static void appendText(java.lang.String fileAbsPath, java.lang.String text) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.lang.IllegalArgumentException
- An argument is out of rangejava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file specified is a directory, or it does not exist and cannot be created, or cannot be appended to.java.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static void appendTextLine(java.io.File file, java.lang.String text) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.lang.IllegalArgumentException
- An argument is out of rangejava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file specified is a directory, or it does not exist and cannot be created, or cannot be appended to.java.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static void appendTextLine(java.lang.String fileAbsPath, java.lang.String text) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.lang.IllegalArgumentException
- An argument is out of rangejava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file specified is a directory, or it does not exist and cannot be created, or cannot be appended to.java.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static void appendText(java.io.File file, java.lang.String text, java.lang.String eolTerminator) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.lang.IllegalArgumentException
- An argument is out of rangejava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file specified is a directory, or it does not exist and cannot be created, or cannot be appended to.java.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static void appendText(java.lang.String fileAbsPath, java.lang.String text, java.lang.String eolTerminator) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.lang.IllegalArgumentException
- An argument is out of rangejava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file specified is a directory, or it does not exist and cannot be created, or cannot be appended to.java.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static void cloneFile(java.io.File originatingFile, java.lang.String destinationPath) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file specified is a directory, it does not exist or cannot be read/created.java.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static void cloneFile(java.lang.String originatingPath, java.lang.String destinationPath) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file specified is a directory, it does not exist or cannot be read/created.java.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static java.lang.String combinePath(java.lang.String path, java.lang.String nextPath)
java.lang.NullPointerException
- An argument is nullpublic static boolean tryCloneFile(java.io.File sourceFile, java.lang.String destAbsPath)
public static boolean tryCloneFile(java.lang.String sourceAbsPath, java.lang.String destAbsPath)
public static void copyFile(java.io.File originatingFile, java.lang.String destinationPath) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file specified is a directory, it does not exist or cannot be read/created.java.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static void copyFile(java.lang.String originatingPath, java.lang.String destinationPath) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file specified is a directory, it does not exist or cannot be read/created.java.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static boolean tryCopyFile(java.io.File sourceFile, java.lang.String destAbsPath)
public static boolean tryCopyFile(java.lang.String sourceAbsPath, java.lang.String destAbsPath)
public static void deleteFile(java.io.File file) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file was a directoryjava.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static void deleteFile(java.lang.String fileAbsPath) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file was a directoryjava.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static boolean tryDeleteFile(java.io.File file)
public static boolean tryDeleteFile(java.lang.String fileAbsPath)
public static boolean exists(java.io.File file)
java.lang.NullPointerException
- An argument is nullpublic static boolean exists(java.lang.String file)
java.lang.NullPointerException
- An argument is nullpublic static java.lang.String getFileExtension(java.io.File file)
java.lang.NullPointerException
- An argument is nullpublic static java.lang.String getFileExtension(java.lang.String filename)
java.lang.NullPointerException
- An argument is nullpublic static java.lang.String getFileName(java.io.File file)
java.lang.NullPointerException
- An argument is nullpublic static java.lang.String getFileName(java.lang.String filename)
java.lang.NullPointerException
- An argument is nullpublic static java.net.URL getResourceUrl(java.lang.String classpath) throws java.io.FileNotFoundException
java.lang.NullPointerException
- An argument is nulljava.io.FileNotFoundException
- The resource specified was not foundpublic static java.net.URL getResourceUrl(java.lang.Package pkg, java.lang.String filename) throws java.io.FileNotFoundException
java.lang.NullPointerException
- An argument is nulljava.io.FileNotFoundException
- The resource specified was not foundpublic static java.io.InputStream getResourceStreamData(java.net.URL url) throws java.io.IOException
java.io.IOException
- An I/O exception occurred during loading of the resourcepublic static java.lang.String getResourceTextData(java.net.URL url) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O exception occurred during loading of the resourcejava.io.FileNotFoundException
- The resource specified was not foundpublic static java.lang.String getResourceTextData(java.net.URL url, java.nio.charset.Charset charset) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O exception occurred during loading of the resourcejava.io.FileNotFoundException
- The resource specified was not foundpublic static byte[] getResourceData(java.net.URL url) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O exception occurred during loading of the resourcejava.io.FileNotFoundException
- The resource specified was not foundpublic static boolean isDirectory(java.io.File file)
java.lang.NullPointerException
- An argument is nullpublic static boolean isDirectory(java.lang.String file)
java.lang.NullPointerException
- An argument is nullpublic static boolean isFile(java.io.File file)
java.lang.NullPointerException
- An argument is nullpublic static boolean isFile(java.lang.String file)
java.lang.NullPointerException
- An argument is nullpublic static boolean moveFile(java.io.File originatingFile, java.lang.String destinationPath) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file specified is a directory, it does not exist or cannot be read/created.java.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static boolean moveFile(java.lang.String originatingPath, java.lang.String destinationPath) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file specified is a directory, it does not exist or cannot be read/created.java.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static boolean tryMoveFile(java.io.File sourceFile, java.lang.String destAbsPath)
public static boolean tryMoveFile(java.lang.String sourceAbsPath, java.lang.String destAbsPath)
public static java.lang.String readFileToEnd(java.io.File file) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file was not found, or it was a directoryjava.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static java.lang.String readFileToEnd(java.lang.String fileAbsPath) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file was not found, or it was a directoryjava.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static java.lang.Iterable<java.lang.String> readFilePerLine(java.io.File file) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file was not found, or it was a directoryjava.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static java.lang.Iterable<java.lang.String> readFilePerLine(java.lang.String fileAbsPath) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file was not found, or it was a directoryjava.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static byte[] readFileInMemory(java.io.File file) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file was not found, or it was a directoryjava.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static byte[] readFileInMemory(java.lang.String fileAbsPath) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file was not found, or it was a directoryjava.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static java.lang.Iterable<byte[]> readFilePerBlock(java.io.File file, int blockSize) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file was not found, or it was a directoryjava.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static java.lang.Iterable<byte[]> readFilePerBlock(java.lang.String fileAbsPath, int blockSize) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- The file was not found, or it was a directoryjava.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static void touchFile(java.io.File file) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- A directory was specified instead of a filejava.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static void touchFile(java.lang.String fileAbsPath) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- A directory was specified instead of a filejava.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static boolean tryTouchFile(java.io.File file)
public static boolean tryTouchFile(java.lang.String fileAbsPath)
public static void createDirectory(java.io.File dirAbsPath) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occurs, or directory creation fails: please note that a partial path may have been created during the
attempt.java.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static void createDirectory(java.lang.String dirAbsPath) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occurs, or directory creation fails: please note that a partial path may have been created during the
attempt.java.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static boolean tryCreateDirectory(java.io.File dirAbsPath)
public static boolean tryCreateDirectory(java.lang.String dirAbsPath)
public static void deleteDirectory(java.io.File dirAbsPath) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occurs, or the directory could not be deletedjava.io.FileNotFoundException
- The specified path is not a directoryjava.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static void deleteDirectory(java.lang.String dirAbsPath) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occurs, or the directory could not be deletedjava.io.FileNotFoundException
- The specified path is not a directoryjava.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static boolean tryDeleteDirectory(java.io.File dirAbsPath)
public static boolean tryDeleteDirectory(java.lang.String dirAbsPath)
public static void deleteDirectoryRecursive(java.io.File dirAbsPath) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occurs, or the directory could not be deletedjava.io.FileNotFoundException
- The specified path is not a directoryjava.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static void deleteDirectoryRecursive(java.lang.String dirAbsPath) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occurs, or the directory could not be deletedjava.io.FileNotFoundException
- The specified path is not a directoryjava.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static boolean tryDeleteDirectoryRecursive(java.io.File dirAbsPath)
public static boolean tryDeleteDirectoryRecursive(java.lang.String dirAbsPath)
public static void touchDirectory(java.io.File dirAbsPath) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- A file was specified instead of a directoryjava.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static void touchDirectory(java.lang.String dirAbsPath) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- A file was specified instead of a directoryjava.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static boolean tryTouchDirectory(java.io.File dirAbsPath)
public static boolean tryTouchDirectory(java.lang.String dirAbsPath)
public static java.io.File[] filterOut(java.io.File[] files, java.util.Set<FileAttribute> fileAttributes) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- A file was specified instead of a directoryjava.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static java.io.File[] filterIn(java.io.File[] files, java.util.Set<FileAttribute> fileAttributes) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occursjava.io.FileNotFoundException
- A file was specified instead of a directoryjava.lang.SecurityException
- Access to filesystem is denied by a SecurityManagerpublic static void createApplicationShortcut(java.lang.String shortcutAbsPath, java.lang.String linkedResourceAbsPath) throws java.io.IOException
shortcutAbsPath
- The destination filename of the shortcut. This will be overwritten if already exists.linkedResourceAbsPath
- The path to the file or folder to link to.java.lang.NullPointerException
- An argument is nulljava.io.IOException
public static void createApplicationShortcut(java.lang.String shortcutAbsPath, java.lang.String linkedResourceAbsPath, java.lang.String applicationWorkingDirectory) throws java.io.IOException
shortcutAbsPath
- The destination filename of the shortcut. This will be overwritten if already exists.linkedResourceAbsPath
- The path to the file or folder to link to.applicationWorkingDirectory
- The working directory of the application. Use null for non-applications: i.e. files or for folders.
This is ignored on OSX, as symlinks are used.java.lang.NullPointerException
- An argument is nulljava.lang.IllegalArgumentException
- The linked resource does not existjava.io.IOException
- An I/O error occurspublic static void createInternetShortcut(java.lang.String shortcutAbsPath, java.lang.String url) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
- An I/O error occurspublic static void performCreateReadWriteDeleteAccess(java.lang.String folderName) throws java.io.IOException
java.lang.NullPointerException
- An argument is nulljava.io.IOException
public static boolean tryPerformCreateReadWriteDeleteAccess(java.lang.String folderName)
public static java.util.List<java.lang.String> scanPath(java.lang.String path, ScanInclusionMode inclusionMode, ScanHiddenMode hiddenMode, ScanDepthMode depthMode, ScanSortMode sortMode, ScanFailMode failMode) throws java.lang.Exception
java.lang.NullPointerException
- An argument is nulljava.lang.IllegalArgumentException
- Unrecognized hide, sort or fail mode. Also occurs when fail mode is SkipAndCollect and
collectedScanErrors is null.java.io.IOException
- An I/O error occurs and the scan fail mode is immediatejava.lang.Throwable
- An error occurs and the scan fail mode is immediatejava.lang.Exception
public static java.util.List<java.lang.String> scanPath(java.lang.String path, ScanInclusionMode inclusionMode, ScanHiddenMode hiddenMode, ScanDepthMode depthMode, ScanSortMode sortMode, ScanFailMode failMode, java.util.List<ScanErrorEntry> collectedScanErrors) throws java.lang.Exception
java.lang.NullPointerException
- An argument is nulljava.lang.IllegalArgumentException
- Unrecognized hide, sort or fail mode. Also occurs when fail mode is SkipAndCollect and
collectedScanErrors is null.java.io.IOException
- An I/O error occurs and the scan fail mode is immediatejava.lang.Exception
- An error occurs and the scan fail mode is immediate