Class FileUtils
java.lang.Object
is.galia.util.FileUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
checkReadableFile
(Path path) static boolean
checkWritableDirectory
(Path path) static String
expandPath
(String path) Expands filesystem paths that start with a tilde (~).static Path
Tries to resolve the location of the file with the given pathname.
-
Method Details
-
checkReadableFile
- Parameters:
path
- Path of the file to check.- Returns:
- Whether the file at the given path exists, is a file, and is readable.
- Throws:
AccessDeniedException
- if the file is not readable. The message is user-friendly.NoSuchFileException
- if the file does not exist. The message is user-friendly.IOException
- if the file does not exist, is not a file, or is not readable. The message is user-friendly.
-
checkWritableDirectory
- Parameters:
path
- Path of the directory to check.- Returns:
- Whether the directory at the given path exists, is a file, and is writable.
- Throws:
AccessDeniedException
- if the directory is not writable. The message is user-friendly.NoSuchFileException
- if the directory does not exist. The message is user-friendly.IOException
- if the file is not a directory. The message is user-friendly.
-
expandPath
-
locate
Tries to resolve the location of the file with the given pathname. Existence of the underlying file is not checked.
- If the pathname is absolute, it is returned as-is.
- If the pathname starts with a tilde (~, an expanded path is returned.
- If it is a filename or relative pathname, it is located (relative pathname intact) in the current working directory.
- Parameters:
file
- Absolute or relative pathname or filename.- Returns:
- Absolute path.
-