Class PathDifference
Object
PathDifference
Calculates the "difference" between a path and a base.
e.g. if a base is c:\root\somePrefix_ and a file is
c:\root\somePrefix_someFile.xml then the difference is _someFile.xml
The difference is recorded separately as directory and filename components.
Internally, both paths are converted to absolute paths and URIs.
- Author:
- Owen Feehan
-
Method Summary
Modifier and TypeMethodDescriptioncombined()The directory-component (if it exists) and filename-component combined.static PathDifferencedifferenceFrom(Path baseDirectoryPath, Path filePath) Finds the difference between a path and a base.The directory component of the difference, if it exists.The file-name component of the difference, if it exists.toString()
-
Method Details
-
differenceFrom
public static PathDifference differenceFrom(Path baseDirectoryPath, Path filePath) throws PathDifferenceException Finds the difference between a path and a base.- Parameters:
baseDirectoryPath- path to a base directory.filePath- the path to resolve.- Returns:
- the difference between the paths.
- Throws:
PathDifferenceException- if the canonical file cannot be found.
-
combined
The directory-component (if it exists) and filename-component combined.- Returns:
- the combined-path
-
toString
-
getFilename
The file-name component of the difference, if it exists. -
getDirectory
The directory component of the difference, if it exists.
-