Package rife.bld.extension.tools
Class IOTools
java.lang.Object
rife.bld.extension.tools.IOTools
I/O Tools.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanExecute(File file) Determines if the specified file exists, is a file, and is executable.static booleancanExecute(String path) Determines if the file at the specified path string exists, is a regular file, and is executable.static booleancanExecute(Path path) Determines if the specified path exists, is a regular file, and is executable.static booleanChecks if the specified file exists.static booleanChecks whether a file or directory exists at the specified path.static booleanChecks if the specified path exists.static booleanisDirectory(File file) Determines if the specifiedFileis a directory.static booleanisDirectory(String path) Determines if the specified path string represents an existing directory.static booleanisDirectory(Path path) Determines if the specifiedPathrepresents an existing directory.static booleanCreates the directory named by the specifiedFile, including any necessary but nonexistent parent directories.static booleanCreates the directory specified by the given path string, including any nonexistent parent directories as necessary.static booleanCreates the directory specified by the givenPath, including any nonexistent parent directories as necessary.static booleanChecks if the specified file does not exist.static booleanChecks whether a file or directory does not exist at the specified path.static booleanChecks if the specified path does not exist.static FileresolveFile(File base, String... segments) Resolves a file path by joining a base file with additional path segments.
-
Method Details
-
canExecute
Determines if the specified file exists, is a file, and is executable.- Parameters:
file- The file to be checked- Returns:
trueif the file exists, is a file, and can be executed;falseotherwise- Since:
- 1.0
-
canExecute
Determines if the specified path exists, is a regular file, and is executable.- Parameters:
path- The path to be checked- Returns:
trueif the path exists, is a regular file, and can be executed;falseotherwise- Since:
- 1.0
-
canExecute
Determines if the file at the specified path string exists, is a regular file, and is executable.- Parameters:
path- The path string to be checked- Returns:
trueif the path exists, is a regular file, and can be executed;falseotherwise- Since:
- 1.0
-
exists
Checks if the specified file exists.- Parameters:
file- The file to check for existence- Returns:
trueif the file is notnulland exists;falseotherwise- Since:
- 1.0
-
exists
Checks if the specified path exists.- Parameters:
path- The path to check for existence- Returns:
trueif the path is notnulland exists;falseotherwise- Since:
- 1.0
-
exists
Checks whether a file or directory exists at the specified path.- Parameters:
path- The file system path to check for existence.- Returns:
trueif the path is notnulland a file or directory exists at the specified path;falseotherwise- Since:
- 1.0
-
isDirectory
Determines if the specifiedFileis a directory.- Parameters:
file- TheFileobject to be checked. Ifnull, this method will returnfalse- Returns:
trueif the file exists and is a directory;falseotherwise- Since:
- 1.0
-
isDirectory
Determines if the specifiedPathrepresents an existing directory.- Parameters:
path- ThePathobject to be checked. Ifnull, this method returnsfalse- Returns:
trueif the path exists and is a directory;falseotherwise- Since:
- 1.0
-
isDirectory
Determines if the specified path string represents an existing directory.- Parameters:
path- The path string to be checked. Ifnullor empty, this method will returnfalse- Returns:
trueif the specified path exists and is a directory;falseotherwise (including when the path string is invalid)- Since:
- 1.0
-
mkdirs
Creates the directory named by the specifiedFile, including any necessary but nonexistent parent directories.- Parameters:
file- TheFileobject representing the directory to be created. Ifnull, this method returnsfalse- Returns:
trueif the directory was created successfully, or if it already exists;falseif the directory could not be created or if the providedfileisnull
-
mkdirs
Creates the directory specified by the givenPath, including any nonexistent parent directories as necessary.- Parameters:
path- ThePathobject representing the directory to be created. Ifnull, this method will returnfalse- Returns:
trueif the directory was created successfully or already exists;falseif the directory could not be created, or if the providedpathisnull
-
mkdirs
Creates the directory specified by the given path string, including any nonexistent parent directories as necessary.- Parameters:
path- The path string representing the directory to be created. Ifnullor blank, this method will returnfalse- Returns:
trueif the directory was created successfully or already exists;falseif the directory could not be created, or if the providedpathisnullor blank
-
notExists
Checks whether a file or directory does not exist at the specified path.- Parameters:
path- The file system path to check for non-existence.- Returns:
trueif the path isnullor no file or directory exists at the specified path;falseotherwise- Since:
- 1.0
-
notExists
Checks if the specified file does not exist.- Parameters:
file- The file to check for non-existence- Returns:
trueif the file isnullor does not exist;falseotherwise- Since:
- 1.0
-
notExists
Checks if the specified path does not exist.- Parameters:
path- The path to check for non-existence- Returns:
trueif the path isnullor does not exist;falseotherwise- Since:
- 1.0
-
resolveFile
Resolves a file path by joining a base file with additional path segments.This method constructs a file path by appending one or more path segments to a base file, using the platform-specific file separator. The resulting
Fileobject represents the complete path but does not create an actual file on the filesystem.- Parameters:
base- the base file path to start fromsegments- additional path segments to append, in order.- Throws:
NullPointerException- ifbaseisnullor ifsegmentsisnull- Since:
- 1.0
-