Package com.g2forge.alexandria.java.io
Class HPath
- java.lang.Object
-
- com.g2forge.alexandria.java.io.HPath
-
public final class HPath extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Path
ensureFS(FileSystem fileSystem, Path path)
Return a path in the specified filesystem which is equivalent topath
.static String
getExtension(Path path)
Get the file extension.static boolean
isEmpty(Path path)
Test if the specified path is empty.static Path
resolveFS(Path base, Path path)
Resolve thepath
against thebase
after ensuring they're from the same filesystem.
-
-
-
Method Detail
-
getExtension
public static String getExtension(Path path)
Get the file extension.- Parameters:
path
- The path to the file to get the extension of.- Returns:
- The extension, including the period.
-
isEmpty
public static boolean isEmpty(Path path)
Test if the specified path is empty. An empty path is one with a single name, whose string value is empty (has zero characters). This is used to represent the default directory in a file system.- Parameters:
path
- The path to test.- Returns:
true
if this path is empty.
-
resolveFS
public static Path resolveFS(Path base, Path path)
Resolve thepath
against thebase
after ensuring they're from the same filesystem.- Parameters:
base
- The base path.path
- The path to resolve against the base.- Returns:
- The resolved path.
- See Also:
Path.resolve(Path)
,ensureFS(FileSystem, Path)
-
ensureFS
public static Path ensureFS(FileSystem fileSystem, Path path)
Return a path in the specified filesystem which is equivalent topath
. Maybe returnpath
if it is already in the appropriatefileSystem
.- Parameters:
fileSystem
- The target filesystem.path
- The path.- Returns:
- A path with all the same components as
path
in the file systemfileSystem
.
-
-