public class URI
extends java.lang.Object
implements java.lang.Cloneable
| Modifier and Type | Field and Description |
|---|---|
static URI |
EMPTY_URI |
static char |
GD_AT |
static char |
GD_COLON |
static char |
GD_HASH |
static char |
GD_QMARK |
static char |
GD_SLASH |
static char |
GD_SQ_BR_CLOSE |
static char |
GD_SQ_BR_OPEN |
static java.lang.String |
URN_SCHEMA_PREFIX |
| Modifier | Constructor and Description |
|---|---|
|
URI(java.lang.String uri)
Constructor.
|
|
URI(java.lang.String baseURI,
java.lang.String path)
Creates an URI from a base URI as
String and a path as String which is regarded to be
relative to the given base URI. |
|
URI(java.lang.String absoluteURI,
URI baseURI)
Creates an URI from
String. |
protected |
URI(URI uri)
Constructor.
|
|
URI(URI baseURI,
java.lang.String path)
Creates an URI from a base URI and a path as which is regarded to be relative to the given base URI.
|
|
URI(URI baseURI,
URI uri)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static URI |
absolutize(URI baseUri,
java.lang.String newUri)
Creates a new URI from newUri and baseUri if newURI is a relative path, otherwise just newUri is the new URI.
|
URI |
clone()
Creates a clone of this URI.
|
boolean |
equals(java.lang.Object obj) |
boolean |
equalsWsdRfc3986(URI other)
Case-insensitive comparison of this with the given uri.
|
java.lang.String |
getFragmentDecoded()
Returns the fragment defined in the URI.
|
java.lang.String |
getHost()
Returns the host defined in the URI.
|
java.lang.String |
getHostWithPort()
Returns a
String containing the host and the port defined in the URI. |
int |
getOctetLength() |
java.lang.String |
getPasswordDecoded()
Returns the password defined in the URI.
|
java.lang.String |
getPath()
Returns the path defined in the URI in its encoded form.
|
java.lang.String |
getPath(int deepness)
Returns the leading part of the path, calculated by the path deepness.
|
java.lang.String |
getPathDecoded()
Returns the path defined in the URI.
|
int |
getPathDeepness()
Returns the deepness of the path inside this URI.
|
int |
getPort()
Returns the port for the host part of this URI.
|
java.lang.String |
getQueryDecoded()
Returns the query defined in the URI.
|
java.lang.String |
getSchemaDecoded()
Returns the schema defined in the URI.
|
java.lang.String |
getUserDecoded()
Returns the user defined in the URI.
|
int |
hashCode() |
boolean |
isIPv6Address() |
static boolean |
isIPv6Address(java.lang.String address)
Check for IPv6 address.
|
boolean |
isRelativeReference()
Returns
true if this is a relative URI, false if the base part is set. |
boolean |
isURN()
Returns
true if this URI has the URN schema, false otherwise. |
boolean |
isValid()
Returns
true, if the URI seams to be correct and there were no problems while parsing it. |
void |
setFragment(java.lang.String fragment) |
void |
setFragmentEncoded(java.lang.String encodedFragment) |
void |
setHost(java.lang.String host) |
void |
setQuery(java.lang.String query) |
void |
setQueryEncoded(java.lang.String encodedQuery) |
java.lang.String |
toString() |
public static final java.lang.String URN_SCHEMA_PREFIX
public static final URI EMPTY_URI
public static final char GD_COLON
public static final char GD_SLASH
public static final char GD_QMARK
public static final char GD_HASH
public static final char GD_SQ_BR_OPEN
public static final char GD_SQ_BR_CLOSE
public static final char GD_AT
public URI(java.lang.String uri)
String.uri - The String representation of an URI. If the URI string must contain any not allowed characters, specified
by the RFC3986, this characters have to be percent encoded.public URI(URI baseURI, URI uri)
baseURI - Base URI, must be a non relative URI, fragment will be ignored.uri - public URI(URI baseURI, java.lang.String path)
This method allows to change the path of the URI. For instance: http://example.org/testing into http://example.org/stable
baseURI - URI to be the base of the newly created URI.path - A path relative to the baseURI. If the path string must contain any not allowed characters, specified by
the RFC3986, this characters have to be percent encoded.public URI(java.lang.String absoluteURI,
URI baseURI)
String.absoluteURI - the String representation of an URI.baseURI - if baseURI is set the absoluteURI is handled as relative URI in relation to the baseURI.public URI(java.lang.String baseURI,
java.lang.String path)
String and a path as String which is regarded to be
relative to the given base URI.baseURI - the String representation of an absolute base URIpath - A path relative to the baseURI. No path with reserved characters allowed, those characters must be
encoded.protected URI(URI uri)
uri - public static URI absolutize(URI baseUri, java.lang.String newUri)
baseUri - newUri - baseUri and newUripublic static final boolean isIPv6Address(java.lang.String address)
This will check the string for textual representation of an IPv6 address. At first, this method will check for the colon which should be between the hex digits.
address - the string representation of the address which should be checked.true if the string is a IPv6 address, false otherwise.public java.lang.String toString()
toString in class java.lang.Objectpublic int getOctetLength()
public URI clone()
clone in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic boolean equalsWsdRfc3986(URI other)
other - true only if this URI instance equals other in terms of RFC3986 equalitypublic boolean isRelativeReference()
true if this is a relative URI, false if the base part is set.true if this is a relative URI, false if the base part is set.public boolean isValid()
true, if the URI seams to be correct and there were no problems while parsing it.true, if the URI could be parsed, false otherwise.public boolean isURN()
true if this URI has the URN schema, false otherwise.true if this URI has the URN schema, false otherwise.public java.lang.String getSchemaDecoded()
public java.lang.String getUserDecoded()
public java.lang.String getPasswordDecoded()
public java.lang.String getHost()
public int getPort()
public java.lang.String getHostWithPort()
String containing the host and the port defined in the URI. e.g. host:port.public java.lang.String getPathDecoded()
public java.lang.String getPath()
public java.lang.String getQueryDecoded()
public void setQuery(java.lang.String query)
public void setQueryEncoded(java.lang.String encodedQuery)
public java.lang.String getFragmentDecoded()
public void setFragment(java.lang.String fragment)
public void setFragmentEncoded(java.lang.String encodedFragment)
public int getPathDeepness()
public java.lang.String getPath(int deepness)
deepness - The path deepness.public boolean isIPv6Address()
public void setHost(java.lang.String host)