public class URIx
extends java.lang.Object
Constructor and Description |
---|
URIx()
Creates empty relative URI
|
URIx(java.io.File file)
Constructs a URI for a File object
|
URIx(java.lang.String uri)
Constructs a URI based on a string version (percent-encoded)
|
URIx(java.lang.String scheme,
java.lang.String host,
java.lang.String path)
Constructs a URI with given scheme, host, and path
|
URIx(java.lang.String scheme,
java.lang.String userInfo,
java.lang.String host,
int port,
java.lang.String path,
java.lang.String query,
java.lang.String fragment)
Complete constructor, builds a URI providing all info
|
URIx(java.lang.String scheme,
java.lang.String userInfo,
java.lang.String host,
java.lang.String path)
Constructs a URI with given scheme, user info, host, and path
|
URIx(java.lang.String scheme,
URIx nestedURI,
java.lang.String fragment)
Creates a nested URI, the scheme must be a zip-type (e.g.
|
URIx(URIx uri)
Copies a URI
|
URIx(URIxScheme scheme,
java.lang.String host,
java.lang.String path)
Constructs a URI with given scheme, host, and path
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Sets the URI to an empty relative URI
|
boolean |
equals(java.lang.Object obj) |
boolean |
equals(URIx other)
Checks equality of two URIs
|
java.lang.String |
getAuthority()
Returns the encoded authority string
|
URIx |
getBaseURI()
Returns the base URI for nested URIs, or the current URI if it is non-zip type
|
static URIx |
getBaseURI(URIx uri)
Determines the base URI, representing the lowest file or relative path in a set of nested URIs
|
java.lang.String |
getFragment()
Returns the encoded fragment
|
java.lang.String |
getHost()
Returns the encoded host
|
URIx |
getNestedURI()
If this is a zip-type URI, returns the nested URI
|
java.lang.String |
getPassword()
Returns the encoded password
|
java.lang.String |
getPath()
Returns the encoded path
|
int |
getPort()
Returns the port
|
java.lang.String |
getQuery()
Gets the encoded query string
|
java.lang.String |
getRawFragment()
Returns the raw fragment
|
java.lang.String |
getRawHost()
Returns the raw host
|
java.lang.String |
getRawPassword()
Returns the raw decoded password
|
java.lang.String |
getRawPath()
Returns the raw path
|
java.lang.String |
getRawQuery()
Gets the raw query string
|
java.lang.String |
getRawUserName()
Returns the decoded username
|
URIxScheme |
getScheme()
Returns the scheme of this URI
|
java.lang.String |
getSchemeSpecificPart()
Returns the encoded scheme-specific part
|
static java.lang.String |
getSchemeStr(java.lang.String uri)
Extracts the scheme string from a URI
|
java.util.ArrayList<URIx> |
getURIStack()
Returns a stack-representation of nested URIs with the base at the end of the stack
|
static java.util.ArrayList<URIx> |
getURIStack(URIx uri)
Creates a stack representation of a nested URI with the base at the end of the stack
|
java.lang.String |
getUserInfo()
Returns the encoded user info string
|
java.lang.String |
getUserName()
Returns the encoded username
|
boolean |
isRelative()
Checks if the URI is relative (i.e.
|
boolean |
isSchemeSupported(java.lang.String scheme)
Checks if the provided scheme is supported.
|
boolean |
isZipType()
Checks if the current URI is of zip-type, which allows for nested URIs.
|
static java.lang.String |
percentDecode(java.lang.String str)
Percent-decodes a string
|
static java.lang.String |
percentEncode(java.lang.String str,
java.lang.String reservedChars)
Percent-encodes a string with a given set of reserved characters.
|
URIx |
relativize(java.lang.String uri)
Creates a URI relative to the current from the provided input.
|
URIx |
relativize(URIx uri)
Creates a URI relative to the current from the provided input.
|
static URIx |
relativize(URIx base,
URIx child)
Creates a relative URI such that child = URIx.resolve(base, relative); Requires that
child is hierarchically equivalent to base, except for difference in path (if not a zip-type)
or fragment (if zip type).
|
URIx |
resolve(java.lang.String rel)
Resolves a relative URI string
|
URIx |
resolve(URIx uri)
Resolves a relative URI
|
static URIx |
resolve(URIx base,
java.io.File file)
Resolves a URI provided a File.
|
static URIx |
resolve(URIx base,
java.lang.String rel)
Resolves a URI provided a string representation of a URI
|
static URIx |
resolve(URIx base,
URIx relative)
Merges two URIs
|
void |
set(java.lang.String uri)
Sets this URI to the encoded string representation
|
void |
set(URIx uri)
Sets this URI to the provided one
|
void |
setAuthority(java.lang.String authority)
Sets the encoded authority string
|
void |
setBaseURI(URIx base)
Sets the nested base URI to the provided one.
|
void |
setFragment(java.lang.String fragment)
Sets the encoded fragment
|
void |
setHost(java.lang.String host)
Sets the encoded host
|
void |
setNestedURI(URIx nestedURI)
Sets the nested URI for zip-type URIs
|
void |
setPassword(java.lang.String password)
Sets the encoded password, null to clear
|
void |
setPath(java.lang.String path)
Sets the encoded path
|
void |
setPort(int port)
Sets the port
|
void |
setQuery(java.lang.String query)
Sets the encoded query string
|
void |
setRawFragment(java.lang.String fragment) |
void |
setRawHost(java.lang.String host)
Sets the raw host
|
void |
setRawPassword(java.lang.String password)
Sets the raw password, null to clear
|
void |
setRawPath(java.lang.String path)
Sets the raw path
|
void |
setRawQuery(java.lang.String query)
Sets the raw query string
|
void |
setRawUserName(java.lang.String userName)
Sets the raw username
|
void |
setScheme(java.lang.String scheme)
Tries to set the scheme
|
void |
setScheme(URIxScheme scheme)
Sets the scheme
|
void |
setSchemeSpecificPart(java.lang.String ssp)
Sets the encoded scheme-specific part
|
void |
setUserInfo(java.lang.String userInfo)
Sets the encoded user info string
|
void |
setUserName(java.lang.String userName)
Sets the encoded username
|
java.lang.String |
toString()
Returns the full string representation of this encoded URI
|
java.net.URI |
toURI()
Converts to a java URI
|
java.net.URL |
toURL() |
public URIx()
public URIx(URIx uri)
uri
- uri to copypublic URIx(java.lang.String uri) throws URIxSyntaxException
uri
- string to parseURIxSyntaxException
- if the URI fails to parsepublic URIx(java.io.File file)
file
- URI file destinationpublic URIx(java.lang.String scheme, java.lang.String host, java.lang.String path) throws URIxSyntaxException
scheme
- scheme stringhost
- encoded host stringpath
- encoded path stringURIxSyntaxException
public URIx(URIxScheme scheme, java.lang.String host, java.lang.String path)
scheme
- scheme typehost
- encoded host stringpath
- encoded path stringURIxSyntaxException
- if the URI fails to parsepublic URIx(java.lang.String scheme, java.lang.String userInfo, java.lang.String host, java.lang.String path) throws URIxSyntaxException
scheme
- scheme stringuserInfo
- encoded userInfo string, which can include username and passwordhost
- encoded host stringpath
- encoded path stringURIxSyntaxException
- if the URI fails to parsepublic URIx(java.lang.String scheme, URIx nestedURI, java.lang.String fragment) throws URIxSyntaxException
scheme
- scheme stringnestedURI
- nested URI to underlying zip resourcefragment
- encoded fragment stringURIxSyntaxException
- if the URI fails to parsepublic URIx(java.lang.String scheme, java.lang.String userInfo, java.lang.String host, int port, java.lang.String path, java.lang.String query, java.lang.String fragment) throws URIxSyntaxException
scheme
- scheme stringuserInfo
- encoded userinfo stringhost
- encoded host stringport
- portpath
- encoded path stringquery
- encoded query stringfragment
- encoded fragment stringURIxSyntaxException
- if the URI fails to parsepublic void set(URIx uri)
uri
- URI to copypublic void clear()
public boolean isSchemeSupported(java.lang.String scheme)
URIxScheme.createScheme(String, int, String[])
scheme
- scheme stringpublic java.lang.String getRawUserName()
public java.lang.String getUserName()
public void setRawUserName(java.lang.String userName)
userName
- usernamepublic void setUserName(java.lang.String userName)
userName
- usernamepublic java.lang.String getRawPassword()
public java.lang.String getPassword()
public void setRawPassword(java.lang.String password)
password
- passwordpublic void setPassword(java.lang.String password)
password
- passwordpublic java.lang.String getRawHost()
public java.lang.String getHost()
public void setRawHost(java.lang.String host)
host
- hostpublic void setHost(java.lang.String host)
host
- hostpublic int getPort()
public void setPort(int port)
port
- portpublic java.lang.String getRawPath()
public java.lang.String getPath()
public void setRawPath(java.lang.String path)
path
- pathpublic void setPath(java.lang.String path)
path
- pathpublic java.lang.String getRawQuery()
public java.lang.String getQuery()
public void setRawQuery(java.lang.String query)
query
- querypublic void setQuery(java.lang.String query)
query
- querypublic URIx getNestedURI()
public void setNestedURI(URIx nestedURI)
nestedURI
- nexted URIpublic java.lang.String getRawFragment()
public java.lang.String getFragment()
public void setRawFragment(java.lang.String fragment)
public void setFragment(java.lang.String fragment)
fragment
- fragmentpublic void setScheme(URIxScheme scheme)
scheme
- schemepublic void setScheme(java.lang.String scheme) throws URIxSyntaxException
scheme
- scheme stringURIxSyntaxException
- if unknown schemepublic java.lang.String getUserInfo()
public void setUserInfo(java.lang.String userInfo)
userInfo
- userInfopublic java.lang.String getAuthority()
public void setAuthority(java.lang.String authority)
authority
- authoritypublic java.lang.String getSchemeSpecificPart()
public void setSchemeSpecificPart(java.lang.String ssp) throws URIxSyntaxException
ssp
- scheme-specific partURIxSyntaxException
- if there is a parse errorpublic static java.lang.String percentEncode(java.lang.String str, java.lang.String reservedChars)
str
- string to encodereservedChars
- characters to encodepublic static java.lang.String percentDecode(java.lang.String str)
str
- string to decodepublic void set(java.lang.String uri) throws URIxSyntaxException
uri
- URI stringURIxSyntaxException
- if there is a parse errorpublic static java.lang.String getSchemeStr(java.lang.String uri)
uri
- URI stringpublic URIxScheme getScheme()
public java.lang.String toString()
toString
in class java.lang.Object
public void setBaseURI(URIx base)
base
- new base URIpublic URIx getBaseURI()
public URIx resolve(java.lang.String rel)
rel
- relative URIpublic URIx resolve(URIx uri)
uri
- relative URIpublic URIx relativize(URIx uri)
uri
- URI to relativize relative to this URIpublic URIx relativize(java.lang.String uri)
uri
- URI to relativize relative to this URIpublic java.util.ArrayList<URIx> getURIStack()
public static java.util.ArrayList<URIx> getURIStack(URIx uri)
uri
- URI to extractpublic boolean isRelative()
public static URIx resolve(URIx base, URIx relative)
base
- URI baserelative
- extension relative to basepublic static URIx resolve(URIx base, java.io.File file)
base
- base URIfile
- file to resolvespublic static URIx resolve(URIx base, java.lang.String rel)
base
- base URIrel
- relative or absolute URI stringpublic static URIx relativize(URIx base, URIx child)
base
- base URIchild
- child URIpublic boolean isZipType()
public static URIx getBaseURI(URIx uri)
uri
- URI to determine base ofpublic java.net.URI toURI() throws java.net.URISyntaxException
java.net.URISyntaxException
- if there is a parsing errorpublic java.net.URL toURL() throws java.net.MalformedURLException, java.net.URISyntaxException
java.net.MalformedURLException
java.net.URISyntaxException
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public boolean equals(URIx other)
other
- URI to compare to