Stay organized with collections
Save and categorize content based on your preferences.
Paths
class Paths
This class consists exclusively of static methods that return a Path
by converting a path string or URI
.
Summary
Public methods |
static Path! |
Converts a path string, or a sequence of strings that when joined form a path string, to a Path .
|
static Path! |
Converts the given URI to a Path object.
|
Public methods
get
static fun get(
first: String!,
vararg more: String!
): Path!
Converts a path string, or a sequence of strings that when joined form a path string, to a Path
.
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 |
Return |
Path! |
the resulting Path |
Exceptions |
java.nio.file.InvalidPathException |
if the path string cannot be converted to a Path |
get
static fun get(uri: URI!): Path!
Converts the given URI to a Path
object.
Parameters |
uri |
URI!: the URI to convert |
Return |
Path! |
the resulting Path |
Exceptions |
java.lang.IllegalArgumentException |
if preconditions on the uri parameter do not hold. The format of the URI is provider specific. |
java.nio.file.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 |
java.lang.SecurityException |
if a security manager is installed and it denies an unspecified permission to access the file system |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-20 UTC."],[],[],null,["# Paths\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nPaths\n=====\n\n```\nclass Paths\n```\n\n|---|--------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [java.nio.file.Paths](#) |\n\nThis class consists exclusively of static methods that return a [Path](/reference/kotlin/java/nio/file/Path) by converting a path string or [URI](../../net/URI.html#).\n\nSummary\n-------\n\n| Public methods ||\n|------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [Path](/reference/kotlin/java/nio/file/Path)! | [get](#get(kotlin.String,%20kotlin.String))`(`first:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `vararg` `more:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Converts a path string, or a sequence of strings that when joined form a path string, to a `Path`. |\n| static [Path](/reference/kotlin/java/nio/file/Path)! | [get](#get(java.net.URI))`(`uri:` `[URI](../../net/URI.html#)!`)` Converts the given URI to a [Path](/reference/kotlin/java/nio/file/Path) object. |\n\nPublic methods\n--------------\n\n### get\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic fun get(\n first: String!, \n vararg more: String!\n): Path!\n```\n\nConverts a path string, or a sequence of strings that when joined form a path string, to a `Path`.\n\n| Parameters ||\n|---------|--------------------------------------------------------------------------------------------------------------------------------------------|\n| `first` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: the path string or initial part of the path string |\n| `more` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: additional strings to be joined to form the path string |\n\n| Return ||\n|-----------------------------------------------|----------------------|\n| [Path](/reference/kotlin/java/nio/file/Path)! | the resulting `Path` |\n\n| Exceptions ||\n|--------------------------------------|----------------------------------------------------|\n| `java.nio.file.InvalidPathException` | if the path string cannot be converted to a `Path` |\n\n**See Also**\n\n- [java.nio.file.FileSystem#getPath](/reference/kotlin/java/nio/file/FileSystem#getPath(kotlin.String,%20kotlin.String))\n- [java.nio.file.Path#of(String,String...)](/reference/kotlin/java/nio/file/Path#of(kotlin.String,%20kotlin.String)) \n\n### get\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic fun get(uri: URI!): Path!\n```\n\nConverts the given URI to a [Path](/reference/kotlin/java/nio/file/Path) object.\n\n| Parameters ||\n|-------|-------------------------------------------------|\n| `uri` | [URI](../../net/URI.html#)!: the URI to convert |\n\n| Return ||\n|-----------------------------------------------|----------------------|\n| [Path](/reference/kotlin/java/nio/file/Path)! | the resulting `Path` |\n\n| Exceptions ||\n|---------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `java.lang.IllegalArgumentException` | if preconditions on the `uri` parameter do not hold. The format of the URI is provider specific. |\n| `java.nio.file.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 |\n| `java.lang.SecurityException` | if a security manager is installed and it denies an unspecified permission to access the file system |\n\n**See Also**\n\n- [java.nio.file.Path#of(URI)](/reference/kotlin/java/nio/file/Path#of(java.net.URI))"]]