# Paths

public final class **Paths** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
This class consists exclusively of static methods that return a `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/Path.html`
by converting a path string or `https://developers.google.com/j2objc/javadoc/jre/reference/java/net/URI.html`.

### Public Method Summary

|---|---|
| static [Path](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/Path.html) | [get](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/Paths.html#get(java.net.URI))([URI](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/URI.html) uri) Converts the given URI to a `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/Path.html` object. |
| static [Path](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/Path.html) | [get](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/Paths.html#get(java.lang.String,%20java.lang.String...))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) first, [String...](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) more) Converts a path string, or a sequence of strings that when joined form a path string, to a `Path`. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Public Methods

#### public static [Path](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/Path.html)
**get**
([URI](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/URI.html) uri)

Converts the given URI to a `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/Path.html` object.

This method iterates over the `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/spi/FileSystemProvider.html#installedProviders()` providers to locate the provider that is identified by the
URI `https://developers.google.com/j2objc/javadoc/jre/reference/java/net/URI.html#getScheme()` of the given URI. URI schemes are
compared without regard to case. If the provider is found then its `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/spi/FileSystemProvider.html#getPath(java.net.URI)` method is invoked to convert the
URI.

In the case of the default provider, identified by the URI scheme
"file", the given URI has a non-empty path component, and undefined query
and fragment components. Whether the authority component may be present
is platform specific. The returned `Path` is associated with the
`https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileSystems.html#getDefault()` file system.

The default provider provides a similar *round-trip* guarantee
to the `https://developers.google.com/j2objc/javadoc/jre/reference/java/io/File.html` class. For a given `Path` *p* it
is guaranteed that
> Paths.get(*p*.`https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/Path.html#toUri()`()).equals( *p*.`https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/Path.html#toAbsolutePath()`())
so long as the original `Path`, the `URI`, and the new `Path` are all created in (possibly different invocations of) the same Java virtual machine. Whether other providers make any guarantees is provider specific and therefore unspecified.

<br />

##### Parameters

| uri | the URI to convert |
|---|---|

##### Returns

- the resulting `Path`

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if preconditions on the `uri` parameter do not hold. The format of the URI is provider specific. |
| [FileSystemNotFoundException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileSystemNotFoundException.html) | 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 |
| [SecurityException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/SecurityException.html) | if a security manager is installed and it denies an unspecified permission to access the file system |
|---|---|

#### public static [Path](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/Path.html)
**get**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) first, [String...](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) more)

Converts a path string, or a sequence of strings that when joined form
a path string, to a `Path`. If `more` does not specify any
elements then the value of the `first` parameter is the path string
to convert. If `more` specifies one or more elements then each
non-empty string, including `first`, is considered to be a sequence
of name elements (see `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/Path.html`) and is joined to form a path string.
The details as to how the Strings are joined is provider specific but
typically they will be joined using the `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileSystem.html#getSeparator()` as the separator. For example, if the name separator is
"`/`" and `getPath("/foo","bar","gus")` is invoked, then the
path string `"/foo/bar/gus"` is converted to a `Path`.
A `Path` representing an empty path is returned if `first`
is the empty string and `more` does not contain any non-empty
strings.

The `Path` is obtained by invoking the `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileSystem.html#getPath(java.lang.String,%20java.lang.String...)` method of the `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileSystems.html#getDefault()` `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileSystem.html`.

Note that while this method is very convenient, using it will imply
an assumed reference to the default `FileSystem` and limit the
utility of the calling code. Hence it should not be used in library code
intended for flexible reuse. A more flexible alternative is to use an
existing `Path` instance as an anchor, such as:

```
     Path dir = ...
     Path path = dir.resolve("file");
 
```

<br />

##### Parameters

| first | the path string or initial part of the path string |
| more | additional strings to be joined to form the path string |
|---|---|

##### Returns

- the resulting `Path`

##### Throws

| [InvalidPathException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/InvalidPathException.html) | if the path string cannot be converted to a `Path` |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileSystem.html#getPath(java.lang.String,%20java.lang.String...)`