Package org.elasticsearch.common.io
Class PathUtils
java.lang.Object
org.elasticsearch.common.io.PathUtils
public final class PathUtils
extends java.lang.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
Modifier and Type Method Description static java.nio.file.Path
get(java.lang.String first, java.lang.String... more)
Returns aPath
from name components.static java.nio.file.Path
get(java.net.URI uri)
Returns aPath
from a URIstatic java.nio.file.Path
get(java.nio.file.Path[] roots, java.lang.String path)
Tries to resolve the given path against the list of available roots.static java.nio.file.Path
get(java.nio.file.Path[] roots, java.net.URI uri)
Tries to resolve the given file uri against the list of available roots.static java.nio.file.FileSystem
getDefaultFileSystem()
Returns the default FileSystem.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
get
public static java.nio.file.Path get(java.lang.String first, java.lang.String... more)Returns aPath
from 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 java.nio.file.Path get(java.net.URI uri)Returns aPath
from 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 java.nio.file.Path get(java.nio.file.Path[] roots, java.lang.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 java.nio.file.Path get(java.nio.file.Path[] roots, java.net.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 java.nio.file.FileSystem getDefaultFileSystem()Returns the default FileSystem.
-