public final class URIPath
extends java.lang.Object
Constructor and Description |
---|
URIPath(java.lang.String path) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
asString()
Obtain the full path.
|
boolean |
endsWith(java.lang.String suffix) |
java.util.Optional<java.lang.String> |
getPart(int index)
Obtain part of the path by index of slashes in the URL.
|
int |
length() |
URIPath |
omitFirst()
Immutable modification, removes first part of the path string.
|
public java.lang.String asString()
public java.util.Optional<java.lang.String> getPart(int index)
Example: "/example/path", 0 returns "example" Example: "/example/path", 1 returns "path" Example: "/example/path", 2 returns empty optional Example: "/example/path/", 2 returns "" Example: "/", 0 returns "" Example: "/", 1 returns empty optional
index
- Index from root, eg. /0/1/2/3 etcpublic boolean endsWith(java.lang.String suffix)
public URIPath omitFirst()
Example: URIPath "/example/path" return value of omitFirst URIPath is "/path" Example: URIPath "/example" return value of omitFirst URIPath is "/" Example: URIPath "/" return value of omitFirst URIPath is ""
public int length()