Class FileUtils
java.lang.Object
org.deltava.util.FileUtils
A utility class for filesystem functions.
- Since:
- 4.2
- Version:
- 10.0
- Author:
- Luke
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FilenameFilter
static final DirectoryStream.Filter
<Path> static final DirectoryStream.Filter
<Path> -
Method Summary
Modifier and TypeMethodDescriptionstatic FilenameFilter
fileFilter
(String prefix, String ext) Utility method to get filenames with a particular prefix and extension.static File
findNewest
(String path, FilenameFilter ff) Returns the newest file in a directory.static void
Sets the owner and group membership for a file.static void
setPermissions
(File f, String... permissions) Sets the permissions for a file.
-
Field Details
-
ACCEPT_ALL
-
IS_FILE
-
IS_DIR
-
-
Method Details
-
findNewest
Returns the newest file in a directory.- Parameters:
path
- the directory pathff
- a FilenameFilter to limit files selected- Returns:
- the File, or null if empty
-
fileFilter
Utility method to get filenames with a particular prefix and extension.- Parameters:
prefix
- the prefixext
- the extension- Returns:
- a FilenameFilter
-
setOwner
Sets the owner and group membership for a file.- Parameters:
f
- the Fileowner
- the owner namegroup
- the group name- Throws:
IOException
- if an error occurs
-
setPermissions
Sets the permissions for a file.- Parameters:
f
- the Filepermissions
- the permission names- Throws:
IOException
- if an error occurs- See Also:
-