public class PathUtils extends Object
| Constructor and Description |
|---|
PathUtils()
Creates a new path utility.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
cleanQuietly(Path path,
MigrationReport report)
Quietly deletes the specified file or recursively cleans up the specified directory by removing
all empty sub-directories.
|
static boolean |
deleteQuietly(Path path,
String type)
Quietly deletes the specified file or recursively deletes the specified directory and audit the
result.
|
String |
getChecksumFor(Path path)
Calculate the checksum for the specified path.
|
Path |
getDDFHome()
Gets the path to ${ddf.home}.
|
boolean |
isRelativeToDDFHome(Path path)
Checks if the specified path is located under ${ddf.home}.
|
Path |
relativizeFromDDFHome(Path path)
Relativizes the specified path from ${ddf.home}.
|
Path |
resolveAgainstDDFHome(Path path)
Resolves the specified path against ${ddf.home}.
|
Path |
resolveAgainstDDFHome(String path)
Resolves the specified path against ${ddf.home}.
|
public PathUtils()
IOError - if unable to determine ${ddf.home}public static boolean deleteQuietly(Path path, String type)
path - the file or directory to be deletedtype - a string representing the type of file or directory to deletetrue if the file or directory was deleted, false otherwiseIllegalArgumentException - if path or type is nullpublic static boolean cleanQuietly(Path path, MigrationReport report)
path - the file ot directory to be cleanedreport - the report where to record warning messages if unable to delete the file or
directoriestrue if the file was deleted or the directory is empty, false
otherwiseIllegalArgumentException - if path or report is null
public Path getDDFHome()
public boolean isRelativeToDDFHome(Path path)
path - the path to check if it is relative from ${ddf.home}true if the path it located under ${ddf.home}; false
otherwisepublic Path relativizeFromDDFHome(Path path)
path - the path to relativize from ${ddf.home}path if it is not located under
${ddf.home}public Path resolveAgainstDDFHome(Path path)
path - the path to resolve against ${ddf.home}
pathpublic Path resolveAgainstDDFHome(String path)
path - the path to resolve against ${ddf.home}pathnamepublic String getChecksumFor(Path path) throws IOException
path - the path to calculate the checksum forIllegalArgumentException - if path is nullIOException - if an I/O error occurredThis work is licensed under a Creative Commons Attribution 4.0 International License.