public class FileTools
extends java.lang.Object
This Class is used to provide helper methods for File Handling.
Modifier and Type | Class and Description |
---|---|
static class |
FileTools.FileSizeRecord
Class holding folder names, names and sizes of files found when calling the
getFileSizes method. |
Modifier and Type | Method and Description |
---|---|
static FileTools.FileSizeRecord[] |
getFileSizes(java.lang.String path,
java.lang.String searchPattern,
boolean scanSubFolders)
Gets the sizes (in bytes) of all files in a given directory (excluding sub-directories).
|
static FileTools.FileSizeRecord[] |
getFileSizes(java.lang.String path,
java.lang.String searchPattern,
boolean scanSubFolders,
boolean sorted,
boolean caseSensitive)
Gets the sizes (in bytes) of all files in a given directory (excluding sub-directories).
|
static boolean |
isSymbolicLink(java.io.File file)
Checks whether a file / directory is a symbolic link.
|
static boolean |
isSymbolicLink(java.lang.String path)
Checks whether a file / directory represented by the given path is a symbolic link.
|
static java.io.File |
resolveSymbolicLink(java.io.File file)
Resolves a file / directory representing a symbolic link to it's real file / directory on the given file system.
|
static java.lang.String |
resolveSymbolicLink(java.lang.String path)
Resolves a file / directory path representing a symbolic link to it's real file / directory path on the given file system.
|
public static final boolean isSymbolicLink(java.lang.String path)
path
- The path of the file / directory in questionpublic static final boolean isSymbolicLink(java.io.File file)
file
- The file / directory in questionpublic static final java.lang.String resolveSymbolicLink(java.lang.String path)
path
- The path of the file / directory representing a symbolic linkpublic static final java.io.File resolveSymbolicLink(java.io.File file)
file
- The file / directory in questionpublic static final FileTools.FileSizeRecord[] getFileSizes(java.lang.String path, java.lang.String searchPattern, boolean scanSubFolders)
path
- The folder which has to be scannedsearchPattern
- The search pattern for files to be searched forscanSubFolders
- Boolean parameter specifying whether or not subfolders should be scannedFileTools.FileSizeRecord
elements holding the names and sizes of all files found in the given directory.public static final FileTools.FileSizeRecord[] getFileSizes(java.lang.String path, java.lang.String searchPattern, boolean scanSubFolders, boolean sorted, boolean caseSensitive)
path
- The folder which has to be scannedsearchPattern
- The search pattern for files to be searched forscanSubFolders
- Boolean parameter specifying whether or not subfolders should be scannedsorted
- Boolean parameter specifying whether or not the returned Array of FileTools.FileSizeRecord
should be sorted (by Subfolder / Filenames that is)caseSensitive
- Boolean parameter specifying whether or not the sort order should be case sensitive, only valid if sorted equals "true"FileTools.FileSizeRecord
elements holding the names and sizes of all files found in the given directory.