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 FilenameFilterstatic final DirectoryStream.Filter<Path> static final DirectoryStream.Filter<Path> -
Method Summary
Modifier and TypeMethodDescriptionstatic FilenameFilterfileFilter(String prefix, String ext) Utility method to get filenames with a particular prefix and extension.static FilefindNewest(String path, FilenameFilter ff) Returns the newest file in a directory.static voidSets the owner and group membership for a file.static voidsetPermissions(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:
-