Package org.elasticsearch.common.io
Class PathUtils
- java.lang.Object
-
- org.elasticsearch.common.io.PathUtils
-
public final class PathUtils extends Object
Utilities for creating a Path from names, or accessing the default FileSystem.This class allows the default filesystem to be changed during tests.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Pathget(String first, String... more)Returns aPathfrom name components.static Pathget(URI uri)Returns aPathfrom a URIstatic Pathget(Path[] roots, String path)Tries to resolve the given path against the list of available roots.static Pathget(Path[] roots, URI uri)Tries to resolve the given file uri against the list of available roots.static FileSystemgetDefaultFileSystem()Returns the default FileSystem.
-
-
-
Method Detail
-
get
public static Path get(String first, String... more)
Returns aPathfrom name components.This works just like
Paths.get(). Remember: just likePaths.get()this is NOT A STRING CONCATENATION UTILITY FUNCTION.Remember: this should almost never be used. Usually resolve a path against an existing one!
-
get
public static Path get(URI uri)
Returns aPathfrom a URIThis works just like
Paths.get().Remember: this should almost never be used. Usually resolve a path against an existing one!
-
get
public static Path get(Path[] roots, String path)
Tries to resolve the given path against the list of available roots. If path starts with one of the listed roots, it returned back by this method, otherwise null is returned.
-
get
public static Path get(Path[] roots, URI uri)
Tries to resolve the given file uri against the list of available roots. If uri starts with one of the listed roots, it returned back by this method, otherwise null is returned.
-
getDefaultFileSystem
public static FileSystem getDefaultFileSystem()
Returns the default FileSystem.
-
-