public final class Uris
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
INVALID_SCHEME
URI Scheme used when relaxed parsing is enabled and the given input stream lead to an invalid URI.
|
| Modifier and Type | Method and Description |
|---|---|
static java.net.URI |
create(java.lang.String s)
Attempts to create a URI instance and will optionally swallow any resulting URISyntaxException depending on
configured
CompatibilityHints. |
static java.lang.String |
decode(java.lang.String s)
Decodes the specified URI string using the UTF-8 charset.
|
static java.lang.String |
encode(java.lang.String s)
Encodes the specified URI string using the UTF-8 charset.
|
public static final java.lang.String INVALID_SCHEME
public static java.lang.String encode(java.lang.String s)
s - a URI stringpublic static java.lang.String decode(java.lang.String s)
s - a URI stringpublic static java.net.URI create(java.lang.String s)
throws java.net.URISyntaxException
CompatibilityHints. Will also automatically attempt encoding of the string representation for
greater compatibility.
When relaxed parsing is enabled and if the string representation is not valid, a second URI creation attempt is made by extracting the scheme from the scheme specific part and URI encoding that later part. For example, "mailto: joe smith@example.com" becomes "mailto:joe%20smith@example.com".
If the second attempts also leads to a URISyntaxException, an opaque URI is constructed with a scheme
of Uris.INVALID_SCHEME and a value corresponding to the initial representation.
s - a string representation of a URI.java.net.URISyntaxException - if a valid URI string is not specified and relaxed parsing is disabled