APIdia Launch Partner
Top Description Constructors Methods
java.nio.file

public final Class Paths

extends Object
Class Inheritance
Imports
java.nio.file.spi.FileSystemProvider, java.net.URI

This class consists exclusively of static methods that return a Path by converting a path string or URI.

API Note

It is recommended to obtain a Path via the Path.of methods instead of via the get methods defined in this class as this class may be deprecated in a future release.

Since
1.7
See Also
Path

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Path

Returns:

the resulting Path
get
(String
the path string or initial part of the path string
first
,
String...
additional strings to be joined to form the path string
more
)

Converts a path string, or a sequence of strings that when joined form a path string, to a Path.

public static Path

Returns:

the resulting Path
get
(URI
the URI to convert
uri
)

Converts the given URI to a Path object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Pathsback to summary
private Paths()

Method Detail

getback to summary
public static Path get(String first, String... more)

Converts a path string, or a sequence of strings that when joined form a path string, to a Path.

Implementation Specification

This method simply invokes Path.of(String, String...) with the given parameters.

Parameters
first:String

the path string or initial part of the path string

more:String[]

additional strings to be joined to form the path string

Returns:Path

the resulting Path

Exceptions
InvalidPathException:
if the path string cannot be converted to a Path
See Also
FileSystem#getPath, Path#of(String, String...)
getback to summary
public static Path get(URI uri)

Converts the given URI to a Path object.

Implementation Specification

This method simply invokes Path.of(URI) with the given parameter.

Parameters
uri:URI

the URI to convert

Returns:Path

the resulting Path

Exceptions
IllegalArgumentException:
if preconditions on the uri parameter do not hold. The format of the URI is provider specific.
FileSystemNotFoundException:
The file system, identified by the URI, does not exist and cannot be created automatically, or the provider identified by the URI's scheme component is not installed
See Also
Path#of(URI)