jaulib v1.3.0
Jau Support Library (C++, Java, ..)
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
org.jau.net.Uri Class Reference

This class implements an immutable Uri as defined by RFC 2396. More...

Collaboration diagram for org.jau.net.Uri:

Classes

class  ASCIIEncoded
 
class  Encoded
 Immutable RFC3986 encoded string. More...
 
class  Util
 

Public Member Functions

 Uri (final Encoded uri) throws URISyntaxException
 Creates a new Uri instance according to the given encoded string uri. More...
 
final boolean isFileScheme ()
 Returns true, if this instance is a file scheme, otherwise false. More...
 
final boolean isJarScheme ()
 Returns true, if this instance is a jar scheme, otherwise false. More...
 
final Encoded getEncoded ()
 Returns the encoded input, never null. More...
 
final String toString ()
 Returns the encoded input as String, never null, same as getEncoded(). More...
 
ASCIIEncoded toASCIIString ()
 Returns the encoded input encoded in US-ASCII. More...
 
final java.net.URI toURI ()
 Returns a new URI instance using the encoded input string, new URI(uri.input), i.e. More...
 
final java.net.URI toURIReencoded () throws URISyntaxException
 Returns a new URI instance based upon this instance. More...
 
final java.net.URL toURL () throws MalformedURLException
 Returns a new URL instance using the encoded input string, new URL(uri.input), i.e. More...
 
final File toFile ()
 If this instance is a file scheme, implementation decodes [ "//"+authority ] + path,
then it processes the result if File#separatorChar == '\' as follows: More...
 
final String getUriFilePathOrASCII ()
 If this uri is a file scheme implementation returns toFile(). More...
 
final Uri getContainedUri () throws URISyntaxException
 If this instance's schemeSpecificPart contains a Uri itself, a sub-Uri, return schemeSpecificPart + # fragment via it's own new Uri instance. More...
 
final Uri getNormalized ()
 Normalizes this Uri's path and return the normalized form if it differs, otherwise this instance. More...
 
Uri getDirectory ()
 Returns this Uri's directory Uri. More...
 
final Uri getParent ()
 Returns this Uri's parent directory Uri. More...
 
Uri getRelativeOf (final Encoded appendPath) throws URISyntaxException
 Returns a new Uri appending the given appendPath to this instance's directory. More...
 
final Uri concat (final Encoded suffix) throws URISyntaxException
 Concatenates the given encoded string to the encoded uri of this instance and returns a new Uri instance with the result. More...
 
final Uri getNewQuery (final Encoded newQuery) throws URISyntaxException
 Returns a new Uri instance w/ the given new query newQuery. More...
 
final boolean equals (final Object o)
 
final int hashCode ()
 

Static Public Member Functions

static String encode (final String vanilla, final String legal)
 All characters are encoded into their hexadecimal value prepended by '', except: More...
 
static String encodeToASCIIString (final String unicode)
 Other characters, which are Unicode chars that are not US-ASCII, and are not ISO Control or are not ISO Space chars are not preserved and encoded into their hexidecimal value prepended by ''. More...
 
static String decode (final Encoded encoded)
 Safe Encoded#decode() call on optional encoded instance. More...
 
static String decode (final String encoded)
 Decodes the string argument which is assumed to be encoded in the
x-www-form-urlencoded
MIME content type using the UTF-8 encoding scheme. More...
 
static Uri create (final String scheme, final String ssp, final String fragment) throws URISyntaxException
 Creates a new Uri instance using the given unencoded arguments. More...
 
static Uri create (final Encoded scheme, final Encoded ssp, final Encoded fragment) throws URISyntaxException
 Creates a new Uri instance using the given encoded arguments. More...
 
static Uri create (final String scheme, final String userinfo, String host, final int port, final String path, final String query, final String fragment) throws URISyntaxException
 Creates a new Uri instance using the given unencoded arguments. More...
 
static Uri create (final Encoded scheme, final Encoded userinfo, final Encoded host, final int port, final Encoded path, final Encoded query, final Encoded fragment) throws URISyntaxException
 Creates a new Uri instance using the given encoded arguments. More...
 
static Uri create (final String scheme, final String host, final String path, final String fragment) throws URISyntaxException
 Creates a new Uri instance using the given unencoded arguments. More...
 
static Uri create (final Encoded scheme, final Encoded host, final Encoded path, final Encoded fragment) throws URISyntaxException
 Creates a new Uri instance using the given encoded arguments. More...
 
static Uri create (final String scheme, final String authority, final String path, final String query, final String fragment) throws URISyntaxException
 Creates a new Uri instance using the given unencoded arguments. More...
 
static Uri create (final Encoded scheme, final Encoded authority, final Encoded path, final Encoded query, final Encoded fragment) throws URISyntaxException
 Creates a new Uri instance using the given encoded arguments. More...
 
static Uri cast (final String encodedUri) throws URISyntaxException
 Casts the given encoded String to a new Encoded instance used to create the resulting Uri instance via Uri(Encoded). More...
 
static Uri valueOfFilepath (final String path) throws URISyntaxException
 Creates a new Uri instance using the given file-path argument. More...
 
static Uri valueOf (final File file) throws URISyntaxException
 Creates a new Uri instance using the given File instance. More...
 
static Uri valueOf (final java.net.URI uri) throws URISyntaxException
 Creates a new Uri instance using the given URI instance. More...
 
static Uri valueOf (final java.net.URL url) throws URISyntaxException
 Creates a new Uri instance using the given URL instance, convenient wrapper for valueOf(URI) and URL#toURI(). More...
 

Public Attributes

final Encoded input
 Encoded input string used at construction, never null. More...
 
final Encoded scheme
 Encoded scheme, null if undefined. More...
 
final Encoded schemeSpecificPart
 Encoded scheme-specific-part, never null. More...
 
final Encoded path
 Encoded path part of scheme-specific-part, never null. More...
 
final boolean hasAuthority
 Indicating whether authority part is defined or not. More...
 
final Encoded authority
 Encoded authority part of scheme-specific-part, null if undefined. More...
 
final Encoded userInfo
 Encoded userinfo part of authority and scheme-specific-part, null if undefined. More...
 
final Encoded host
 Encoded host part of authority and scheme-specific-part, null if undefined. More...
 
final int port
 Encoded port part of authority and scheme-specific-part, -1 if undefined. More...
 
final Encoded query
 Encoded query part of scheme-specific-part, null if undefined. More...
 
final Encoded fragment
 Encoded fragment, null if undefined. More...
 
final boolean absolute
 Indicating whether this Uri is absolute, i.e. More...
 
final boolean opaque
 Indicating whether this Uri is opaque, i.e. More...
 

Static Public Attributes

static final String UNRESERVED = "_-.~"
 RFC 3986 section 2.3 Unreserved Characters (January 2005) More...
 
static final String RESERVED = punct + "!*\'()@/?#[]"
 RFC 3986 section 2.2 Reserved Characters (January 2005) More...
 
static final String RESERVED_2 = punct + "!*\'()@/?[]"
 
static final String USERINFO_LEGAL = UNRESERVED + punct
 Valid charset for RFC 2396 authority's user-info, additional to legal alphanum characters. More...
 
static final String AUTHORITY_LEGAL = "@[]" + USERINFO_LEGAL
 Valid charset for RFC 2396 authority, additional to legal alphanum characters. More...
 
static final String PATH_LEGAL = "/!" + UNRESERVED
 Valid charset for RFC 2396 path, additional to legal alphanum characters. More...
 
static final String QUERY_LEGAL = UNRESERVED + RESERVED_2 + "\\\""
 Valid charset for RFC 2396 query, additional to legal alphanum characters. More...
 
static final String SSP_LEGAL = QUERY_LEGAL
 Valid charset for RFC 2396 scheme-specific-part, additional to legal alphanum characters. More...
 
static final String FRAG_LEGAL = UNRESERVED + RESERVED
 Valid charset for RFC 2396 fragment, additional to legal alphanum characters. More...
 
static final char SCHEME_SEPARATOR = ':'
 {@value} More...
 
static final char QUERY_SEPARATOR = '?'
 {@value} More...
 
static final char FRAGMENT_SEPARATOR = '#'
 {@value} More...
 
static final String FILE_SCHEME = "file"
 {@value} More...
 
static final String HTTP_SCHEME = "http"
 {@value} More...
 
static final String HTTPS_SCHEME = "https"
 {@value} More...
 
static final String JAR_SCHEME = "jar"
 {@value} More...
 
static final char JAR_SCHEME_SEPARATOR = '!'
 A JAR sub-protocol is separated from the JAR entry w/ this separator {@value}. More...
 

Detailed Description

This class implements an immutable Uri as defined by RFC 2396.

Character encoding is employed as defined by RFC 3986, see RFC 3986 section 2.1, while multibyte unicode characters are preserved in encoded parts.

  1 [scheme:]scheme-specific-part[fragment]
  2 [scheme:][//authority]path[?query][fragment]
  3 [scheme:][//[user-info@]host[:port]]path[?query][fragment]

     scheme-specific-part: [//authority]path[?query]
     authority:            [user-info@]host[:port]

<p<blockquote>‍

RFC 3986 section 2.2 Reserved Characters (January 2005)

! * ' ( ) ; : </code> & = + $ , / ? # [ ]

RFC 3986 section 2.3 Unreserved Characters (January 2005)

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
a b c d e f g h i j k l m n o p q r s t u v w x y z
0 1 2 3 4 5 6 7 8 9 - _ . ~

Other characters in a Uri must be percent encoded.

Since
0.3.0

Definition at line 162 of file Uri.java.

Constructor & Destructor Documentation

◆ Uri()

org.jau.net.Uri.Uri ( final Encoded  uri) throws URISyntaxException

Creates a new Uri instance according to the given encoded string uri.

Parameters
urithe RFC3986 encoded RFC2396 Uri representation to be parsed into a Uri object
Exceptions
URISyntaxExceptionif the given string uri doesn't fit to the specification RFC2396 and RFC3986 or could not be parsed correctly.

Definition at line 1235 of file Uri.java.

Here is the caller graph for this function:

Member Function Documentation

◆ cast()

static Uri org.jau.net.Uri.cast ( final String  encodedUri) throws URISyntaxException
static

Casts the given encoded String to a new Encoded instance used to create the resulting Uri instance via Uri(Encoded).

No encoding will be performed on the given encodedUri, use with care.

Exceptions
URISyntaxException

Definition at line 1073 of file Uri.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ concat()

final Uri org.jau.net.Uri.concat ( final Encoded  suffix) throws URISyntaxException

Concatenates the given encoded string to the encoded uri of this instance and returns a new Uri instance with the result.

Exceptions
URISyntaxExceptionif the concatenated string uri doesn't fit to the specification RFC2396 and RFC3986 or could not be parsed correctly.

Definition at line 1702 of file Uri.java.

Here is the call graph for this function:

◆ create() [1/8]

static Uri org.jau.net.Uri.create ( final Encoded  scheme,
final Encoded  authority,
final Encoded  path,
final Encoded  query,
final Encoded  fragment 
) throws URISyntaxException
static

Creates a new Uri instance using the given encoded arguments.

This constructor first creates a temporary Uri string from the given encoded encoded components. This string will be parsed later on to create the Uri instance.

The given encoded components are taken as-is, i.e. no re-encoding will be performed! However, Uri parsing will re-evaluate encoding of the resulting components.

[scheme:][//authority][path][?query][#fragment]

host and port may be undefined or invalid, in the optional authority.

Parameters
schemethe encoded scheme part of the Uri.
authoritythe encoded authority part of the Uri.
paththe encoded path to the resource on the host.
querythe encoded query part of the Uri to specify parameters for the resource.
fragmentthe encoded fragment part of the Uri.
Exceptions
URISyntaxExceptionif the temporary created string doesn't fit to the specification RFC2396 or could not be parsed correctly.

Definition at line 1032 of file Uri.java.

Here is the call graph for this function:

◆ create() [2/8]

static Uri org.jau.net.Uri.create ( final Encoded  scheme,
final Encoded  host,
final Encoded  path,
final Encoded  fragment 
) throws URISyntaxException
static

Creates a new Uri instance using the given encoded arguments.

This constructor first creates a temporary Uri string from the given encoded components. This string will be parsed later on to create the Uri instance.

The given encoded components are taken as-is, i.e. no re-encoding will be performed! However, Uri parsing will re-evaluate encoding of the resulting components.

[scheme:]host[path][#fragment]

host must be valid, if defined.

Parameters
schemethe encoded scheme part of the Uri.
hostthe encoded host name of the Uri.
paththe encoded path to the resource on the host.
fragmentthe encoded fragment part of the Uri.
Exceptions
URISyntaxExceptionif the temporary created string doesn't fit to the specification RFC2396 or could not be parsed correctly.

Definition at line 941 of file Uri.java.

Here is the call graph for this function:

◆ create() [3/8]

static Uri org.jau.net.Uri.create ( final Encoded  scheme,
final Encoded  ssp,
final Encoded  fragment 
) throws URISyntaxException
static

Creates a new Uri instance using the given encoded arguments.

This constructor first creates a temporary Uri string from the given encoded components. This string will be parsed later on to create the Uri instance.

The given encoded components are taken as-is, i.e. no re-encoding will be performed! However, Uri parsing will re-evaluate encoding of the resulting components.

[scheme:]scheme-specific-part[#fragment]

host and port may be undefined or invalid within scheme-specific-part.

Parameters
schemethe encoded scheme part of the Uri.
sspthe encoded scheme-specific-part of the Uri.
fragmentthe encoded fragment part of the Uri.
Exceptions
URISyntaxExceptionif the temporary created string doesn't fit to the specification RFC2396 or could not be parsed correctly.

Definition at line 706 of file Uri.java.

Here is the call graph for this function:

◆ create() [4/8]

static Uri org.jau.net.Uri.create ( final Encoded  scheme,
final Encoded  userinfo,
final Encoded  host,
final int  port,
final Encoded  path,
final Encoded  query,
final Encoded  fragment 
) throws URISyntaxException
static

Creates a new Uri instance using the given encoded arguments.

This constructor first creates a temporary Uri string from the given encoded components. This string will be parsed later on to create the Uri instance.

The given encoded components are taken as-is, i.e. no re-encoding will be performed! However, Uri parsing will re-evaluate encoding of the resulting components.

[scheme:][user-info@]host[:port][path][?query][#fragment]

host and port must be defined and valid, if any authority components are defined, i.e. user-info, host or port.

Parameters
schemethe encoded scheme part of the Uri.
userinfothe encoded user information of the Uri for authentication and authorization, null for undefined.
hostthe encoded host name of the Uri, null for undefined.
portthe port number of the Uri, -1 for undefined.
paththe encoded path to the resource on the host.
querythe encoded query part of the Uri to specify parameters for the resource.
fragmentthe encoded fragment part of the Uri.
Exceptions
URISyntaxExceptionif the temporary created string doesn't fit to the specification RFC2396 or could not be parsed correctly.

Definition at line 840 of file Uri.java.

Here is the call graph for this function:

◆ create() [5/8]

static Uri org.jau.net.Uri.create ( final String  scheme,
final String  authority,
final String  path,
final String  query,
final String  fragment 
) throws URISyntaxException
static

Creates a new Uri instance using the given unencoded arguments.

This constructor first creates a temporary Uri string from the given unencoded components. This string will be parsed later on to create the Uri instance.

[scheme:][//authority][path][?query][#fragment]

host and port may be undefined or invalid, in the optional authority.

Parameters
schemethe unencoded scheme part of the Uri.
authoritythe unencoded authority part of the Uri.
paththe unencoded path to the resource on the host.
querythe unencoded query part of the Uri to specify parameters for the resource.
fragmentthe unencoded fragment part of the Uri.
Exceptions
URISyntaxExceptionif the temporary created string doesn't fit to the specification RFC2396 or could not be parsed correctly.

Definition at line 968 of file Uri.java.

Here is the call graph for this function:

◆ create() [6/8]

static Uri org.jau.net.Uri.create ( final String  scheme,
final String  host,
final String  path,
final String  fragment 
) throws URISyntaxException
static

Creates a new Uri instance using the given unencoded arguments.

This constructor first creates a temporary Uri string from the given unencoded components. This string will be parsed later on to create the Uri instance.

[scheme:]host[path][#fragment]

host must be valid, if defined.

Parameters
schemethe unencoded scheme part of the Uri.
hostthe unencoded host name of the Uri.
paththe unencoded path to the resource on the host.
fragmentthe unencoded fragment part of the Uri.
Exceptions
URISyntaxExceptionif the temporary created string doesn't fit to the specification RFC2396 or could not be parsed correctly.

Definition at line 912 of file Uri.java.

Here is the call graph for this function:

◆ create() [7/8]

static Uri org.jau.net.Uri.create ( final String  scheme,
final String  ssp,
final String  fragment 
) throws URISyntaxException
static

Creates a new Uri instance using the given unencoded arguments.

This constructor first creates a temporary Uri string from the given unencoded components. This string will be parsed later on to create the Uri instance.

[scheme:]scheme-specific-part[#fragment]

host and port may be undefined or invalid within scheme-specific-part.

Parameters
schemethe unencoded scheme part of the Uri.
sspthe unencoded scheme-specific-part of the Uri.
fragmentthe unencoded fragment part of the Uri.
Exceptions
URISyntaxExceptionif the temporary created string doesn't fit to the specification RFC2396 or could not be parsed correctly.

Definition at line 661 of file Uri.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create() [8/8]

static Uri org.jau.net.Uri.create ( final String  scheme,
final String  userinfo,
String  host,
final int  port,
final String  path,
final String  query,
final String  fragment 
) throws URISyntaxException
static

Creates a new Uri instance using the given unencoded arguments.

This constructor first creates a temporary Uri string from the given unencoded components. This string will be parsed later on to create the Uri instance.

[scheme:][user-info@]host[:port][path][?query][#fragment]

host and port must be defined and valid, if any authority components are defined, i.e. user-info, host or port.

Parameters
schemethe unencoded scheme part of the Uri.
userinfothe unencoded user information of the Uri for authentication and authorization, null for undefined.
hostthe unencoded host name of the Uri, null for undefined.
portthe port number of the Uri, -1 for undefined.
paththe unencoded path to the resource on the host.
querythe unencoded query part of the Uri to specify parameters for the resource.
fragmentthe unencoded fragment part of the Uri.
Exceptions
URISyntaxExceptionif the temporary created string doesn't fit to the specification RFC2396 or could not be parsed correctly.

Definition at line 750 of file Uri.java.

Here is the call graph for this function:

◆ decode() [1/2]

static String org.jau.net.Uri.decode ( final Encoded  encoded)
static

Safe Encoded#decode() call on optional encoded instance.

Parameters
encodedEncoded instance to be decoded, may be null.
Returns
the decoded String or null if encoded was null.

Definition at line 577 of file Uri.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decode() [2/2]

static String org.jau.net.Uri.decode ( final String  encoded)
static

Decodes the string argument which is assumed to be encoded in the
x-www-form-urlencoded
MIME content type using the UTF-8 encoding scheme.

'' and two following hex digit characters are converted to the equivalent byte value. All other characters are passed through unmodified.

e.g. "A%20B%20C %24%25" -> "A B C $%"

Parameters
encodedThe encoded string.
Returns
java.lang.String The decoded version.

Definition at line 596 of file Uri.java.

◆ encode()

static String org.jau.net.Uri.encode ( final String  vanilla,
final String  legal 
)
static

All characters are encoded into their hexadecimal value prepended by '', except:

  1. letters ('a'..'z', 'A'..'Z')
  2. numbers ('0'..'9')
  3. characters in the legal-set parameter
  4. others (unicode characters that are not in US-ASCII set, and are not ISO Control or are not ISO Space characters)

Use encodeToASCIIString(String) for US-ASCII encoding.

Consider using Encoded#Encoded(String, String) in APIs to distinguish encoded from unencoded data by type.

Parameters
vanillathe string to be encoded
legalextended character set, allowed to be preserved in the vanilla string
Returns
java.lang.String the converted string

Definition at line 524 of file Uri.java.

Here is the caller graph for this function:

◆ encodeToASCIIString()

static String org.jau.net.Uri.encodeToASCIIString ( final String  unicode)
static

Other characters, which are Unicode chars that are not US-ASCII, and are not ISO Control or are not ISO Space chars are not preserved and encoded into their hexidecimal value prepended by ''.

For example: Euro currency symbol -> "%E2%82%AC".

Consider using ASCIIEncoded#ASCIIEncoded(String) in APIs to distinguish encoded from unencoded data by type.

Parameters
unicodestring to be converted
Returns
java.lang.String the converted string

Definition at line 559 of file Uri.java.

Here is the caller graph for this function:

◆ equals()

final boolean org.jau.net.Uri.equals ( final Object  o)

Compares this Uri instance with the given argument o and determines if both are equal. Two Uri instances are equal if all single parts are identical in their meaning.

Parameters
othe Uri this instance has to be compared with.
Returns
true if both Uri instances point to the same resource, false otherwise.

Definition at line 1740 of file Uri.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getContainedUri()

final Uri org.jau.net.Uri.getContainedUri ( ) throws URISyntaxException

If this instance's schemeSpecificPart contains a Uri itself, a sub-Uri, return schemeSpecificPart + # fragment via it's own new Uri instance.

In case this Uri is a jar-scheme, the query is omitted, since 0.3.0

Otherwise method returns null.

Example 1:
    This instance: jar:scheme2:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class
    Returned Uri:  scheme2:/some/path/gluegen-rt.jar

Example 2:
    This instance: jar:scheme2:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class?lala=01fragment
    Returned Uri:  scheme2:/some/path/gluegen-rt.jar::fragment

Example 3:
    This instance: scheme1:scheme2:/some/path/gluegen-rt.jar!/?lala=01fragment
    Returned Uri:  scheme2:/some/path/gluegen-rt.jar?lala=01fragment
Exceptions
URISyntaxExceptionif this Uri is a container Uri and does not comply with the container spec, i.e. a JAR Uri

Definition at line 1414 of file Uri.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDirectory()

Uri org.jau.net.Uri.getDirectory ( )

Returns this Uri's directory Uri.

This Uri path will be normalized before returning the directory.

If this Uri's directory cannot be found, or already denotes a directory, method returns this instance.

Example-1:
    this-uri: http:/some/path/gluegen-rt.jar?arg=1#frag
    result:   http:/some/path/?arg=1#frag

Example-2:
    this-uri: file:/some/path/
    result:   file:/some/path/

Example-3:
    this-uri: file:/some/path/lala/lili/../../hello.txt
    result:   file:/some/path/
Exceptions
URISyntaxExceptionif the new string uri doesn't fit to the specification RFC2396 and RFC3986 or could not be parsed correctly.

Definition at line 1599 of file Uri.java.

Here is the caller graph for this function:

◆ getEncoded()

final Encoded org.jau.net.Uri.getEncoded ( )

Returns the encoded input, never null.

Definition at line 1255 of file Uri.java.

Here is the caller graph for this function:

◆ getNewQuery()

final Uri org.jau.net.Uri.getNewQuery ( final Encoded  newQuery) throws URISyntaxException

Returns a new Uri instance w/ the given new query newQuery.

Exceptions
URISyntaxExceptionif this Uri is opaque or if the new string uri doesn't fit to the specification RFC2396 and RFC3986 or could not be parsed correctly.

Definition at line 1717 of file Uri.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNormalized()

final Uri org.jau.net.Uri.getNormalized ( )

Normalizes this Uri's path and return the normalized form if it differs, otherwise this instance.

Example-1:
    This instance  : jar:http://some/path/../gluegen-rt.jar!/com/Test.class?arg=1#frag
    Normalized     : jar:http://some/gluegen-rt.jar!/com/Test.class?arg=1#frag

Example-2:
    This instance  : http://some/path/../gluegen-rt.jar?arg=1#frag
    Normalized     : http://some/gluegen-rt.jar?arg=1#frag

Definition at line 1560 of file Uri.java.

Here is the caller graph for this function:

◆ getParent()

final Uri org.jau.net.Uri.getParent ( )

Returns this Uri's parent directory Uri.

This Uri path will be normalized before traversing up one directory.

If a parent folder cannot be found, method returns null.

Example-1:
    This instance  : jar:http://some/path/gluegen-rt.jar!/com/Test.class?arg=1#frag
    Returned Uri #1: jar:http://some/path/gluegen-rt.jar!/com/?arg=1#frag
    Returned Uri #2: jar:http://some/path/gluegen-rt.jar!/?arg=1#frag
    Returned Uri #3: null

Example-2:
    This instance  : http://some/path/gluegen-rt.jar?arg=1#frag
    Returned Uri #1: http://some/path/?arg=1#frag
    Returned Uri #2: http://some/?arg=1#frag
    Returned Uri #2: null

Example-3:
    This instance  : http://some/path/../gluegen-rt.jar?arg=1#frag
    Returned Uri #1: http://some/?arg=1#frag
    Returned Uri #2: null

Definition at line 1641 of file Uri.java.

Here is the caller graph for this function:

◆ getRelativeOf()

Uri org.jau.net.Uri.getRelativeOf ( final Encoded  appendPath) throws URISyntaxException

Returns a new Uri appending the given appendPath to this instance's directory.

If appendPath is empty, method behaves like getNormalized().

This resulting path will be normalized.

Example-1:
    append: null
    this-uri: http:/some/path/gluegen-rt.jar
    result:   http:/some/path/gluegen-rt.jar

Example-2:
    append: test.txt
    this-uri: file:/some/path/gluegen-rt.jar
    result:   file:/some/path/test.txt

Example-3:
    append: test.txt
    this-uri: file:/some/path/lala/lili/../../hello.txt
    result:   file:/some/path/test.txt
Parameters
appendPathdenotes a relative path to be appended to this Uri's directory
Exceptions
URISyntaxExceptionif the resulting uri doesn't fit to the specification RFC2396 and RFC3986 or could not be parsed correctly.

Definition at line 1686 of file Uri.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getUriFilePathOrASCII()

final String org.jau.net.Uri.getUriFilePathOrASCII ( )

If this uri is a file scheme implementation returns toFile().

File#getPath().

Otherwise it returns the toASCIIString() encoded URI.

Definition at line 1381 of file Uri.java.

Here is the call graph for this function:

◆ hashCode()

final int org.jau.net.Uri.hashCode ( )

Gets the hashcode value of this Uri instance.

Definition at line 1822 of file Uri.java.

Here is the caller graph for this function:

◆ isFileScheme()

final boolean org.jau.net.Uri.isFileScheme ( )

Returns true, if this instance is a file scheme, otherwise false.

Definition at line 1240 of file Uri.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isJarScheme()

final boolean org.jau.net.Uri.isJarScheme ( )

Returns true, if this instance is a jar scheme, otherwise false.

Since
0.3.0

Definition at line 1248 of file Uri.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toASCIIString()

ASCIIEncoded org.jau.net.Uri.toASCIIString ( )

Returns the encoded input encoded in US-ASCII.

Definition at line 1270 of file Uri.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toFile()

final File org.jau.net.Uri.toFile ( )

If this instance is a file scheme, implementation decodes [ "//"+authority ] + path,
then it processes the result if File#separatorChar == '\' as follows:

  • slash -> backslash
  • drop a starting single backslash, preserving windows UNC

and returns the resulting new File instance.

Otherwise implementation returns null.

Definition at line 1352 of file Uri.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString()

final String org.jau.net.Uri.toString ( )

Returns the encoded input as String, never null, same as getEncoded().

Definition at line 1263 of file Uri.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toURI()

final java.net.URI org.jau.net.Uri.toURI ( )

Returns a new URI instance using the encoded input string, new URI(uri.input), i.e.

no re-encoding will be performed.

See also
#toURIReencoded(boolean)
#valueOf(URI)

Definition at line 1285 of file Uri.java.

Here is the call graph for this function:

◆ toURIReencoded()

final java.net.URI org.jau.net.Uri.toURIReencoded ( ) throws URISyntaxException

Returns a new URI instance based upon this instance.

All Uri parts of this instance will be decoded and encoded by the URI constructor, i.e. re-encoding will be performed.

Exceptions
URISyntaxExceptionif the given string uri doesn't fit to the specification RFC2396 or could not be parsed correctly.
See also
toURI()
#valueOf(URI)

Definition at line 1306 of file Uri.java.

Here is the call graph for this function:

◆ toURL()

final java.net.URL org.jau.net.Uri.toURL ( ) throws MalformedURLException

Returns a new URL instance using the encoded input string, new URL(uri.input), i.e.

no re-encoding will be performed.

Exceptions
MalformedURLExceptionif an error occurs while creating the URL or no protocol handler could be found.

Definition at line 1331 of file Uri.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ valueOf() [1/3]

static Uri org.jau.net.Uri.valueOf ( final File  file) throws URISyntaxException
static

Creates a new Uri instance using the given File instance.

This constructor first creates a temporary Uri string from the given components. This string will be parsed later on to create the Uri instance.

file:path

Parameters
fileusing slashified absolute-path for the path of the file schema, utilizing valueOfFilepath(String).
Exceptions
URISyntaxExceptionif the temporary created string doesn't fit to the specification RFC2396 or could not be parsed correctly.

Definition at line 1126 of file Uri.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ valueOf() [2/3]

static Uri org.jau.net.Uri.valueOf ( final java.net.URI  uri) throws URISyntaxException
static

Creates a new Uri instance using the given URI instance.

Re-encoding will be performed if the given URI is not opaque.

See PARSE_HINT_FIX_PATH for issues of injecting opaque URLs.

Parameters
uriA given URI instance
Exceptions
URISyntaxExceptionif the temporary created string doesn't fit to the specification RFC2396 or could not be parsed correctly.

Definition at line 1144 of file Uri.java.

Here is the call graph for this function:

◆ valueOf() [3/3]

static Uri org.jau.net.Uri.valueOf ( final java.net.URL  url) throws URISyntaxException
static

Creates a new Uri instance using the given URL instance, convenient wrapper for valueOf(URI) and URL#toURI().

Re-encoding will be performed if the given URL is not opaque, see valueOf(URI).

See PARSE_HINT_FIX_PATH for issues of injecting opaque URLs.

Parameters
urlA given URL instance
Exceptions
URISyntaxExceptionif the temporary created string doesn't fit to the specification RFC2396 or could not be parsed correctly.

Definition at line 1172 of file Uri.java.

Here is the call graph for this function:

◆ valueOfFilepath()

static Uri org.jau.net.Uri.valueOfFilepath ( final String  path) throws URISyntaxException
static

Creates a new Uri instance using the given file-path argument.

This constructor first creates a temporary Uri string from the given components. This string will be parsed later on to create the Uri instance.

file:path

Parameters
paththe unencoded path of the file schema.
Exceptions
URISyntaxExceptionif the temporary created string doesn't fit to the specification RFC2396 or could not be parsed correctly.

Definition at line 1092 of file Uri.java.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ absolute

final boolean org.jau.net.Uri.absolute

Indicating whether this Uri is absolute, i.e.

has a scheme and hence an absolute scheme-specific-part.

Definition at line 1216 of file Uri.java.

◆ authority

final Encoded org.jau.net.Uri.authority

Encoded authority part of scheme-specific-part, null if undefined.

Definition at line 1201 of file Uri.java.

◆ AUTHORITY_LEGAL

final String org.jau.net.Uri.AUTHORITY_LEGAL = "@[]" + USERINFO_LEGAL
static

Valid charset for RFC 2396 authority, additional to legal alphanum characters.

{@value} + alphanum

Definition at line 239 of file Uri.java.

◆ FILE_SCHEME

final String org.jau.net.Uri.FILE_SCHEME = "file"
static

{@value}

Definition at line 288 of file Uri.java.

◆ FRAG_LEGAL

final String org.jau.net.Uri.FRAG_LEGAL = UNRESERVED + RESERVED
static

Valid charset for RFC 2396 fragment, additional to legal alphanum characters.

{@value} + alphanum

Definition at line 278 of file Uri.java.

◆ fragment

final Encoded org.jau.net.Uri.fragment

Encoded fragment, null if undefined.

Definition at line 1213 of file Uri.java.

◆ FRAGMENT_SEPARATOR

final char org.jau.net.Uri.FRAGMENT_SEPARATOR = '#'
static

{@value}

Definition at line 286 of file Uri.java.

◆ hasAuthority

final boolean org.jau.net.Uri.hasAuthority

Indicating whether authority part is defined or not.

Definition at line 1199 of file Uri.java.

◆ host

final Encoded org.jau.net.Uri.host

Encoded host part of authority and scheme-specific-part, null if undefined.

Definition at line 1205 of file Uri.java.

◆ HTTP_SCHEME

final String org.jau.net.Uri.HTTP_SCHEME = "http"
static

{@value}

Definition at line 290 of file Uri.java.

◆ HTTPS_SCHEME

final String org.jau.net.Uri.HTTPS_SCHEME = "https"
static

{@value}

Definition at line 292 of file Uri.java.

◆ input

final Encoded org.jau.net.Uri.input

Encoded input string used at construction, never null.

Definition at line 1181 of file Uri.java.

◆ JAR_SCHEME

final String org.jau.net.Uri.JAR_SCHEME = "jar"
static

{@value}

Definition at line 294 of file Uri.java.

◆ JAR_SCHEME_SEPARATOR

final char org.jau.net.Uri.JAR_SCHEME_SEPARATOR = '!'
static

A JAR sub-protocol is separated from the JAR entry w/ this separator {@value}.

Even if no class is specified '!/' must follow!.

Definition at line 296 of file Uri.java.

◆ opaque

final boolean org.jau.net.Uri.opaque

Indicating whether this Uri is opaque, i.e.

non-hierarchical scheme-specific-part.

An opaque Uri has no scheme-specific-part being parsed, i.e. path, query and authority are null.

Definition at line 1225 of file Uri.java.

◆ path

final Encoded org.jau.net.Uri.path

Encoded path part of scheme-specific-part, never null.

Definition at line 1196 of file Uri.java.

◆ PATH_LEGAL

final String org.jau.net.Uri.PATH_LEGAL = "/!" + UNRESERVED
static

Valid charset for RFC 2396 path, additional to legal alphanum characters.

{@value} + alphanum

Definition at line 248 of file Uri.java.

◆ port

final int org.jau.net.Uri.port

Encoded port part of authority and scheme-specific-part, -1 if undefined.

Definition at line 1207 of file Uri.java.

◆ query

final Encoded org.jau.net.Uri.query

Encoded query part of scheme-specific-part, null if undefined.

Definition at line 1210 of file Uri.java.

◆ QUERY_LEGAL

final String org.jau.net.Uri.QUERY_LEGAL = UNRESERVED + RESERVED_2 + "\\\""
static

Valid charset for RFC 2396 query, additional to legal alphanum characters.

{@value} + alphanum

Definition at line 258 of file Uri.java.

◆ QUERY_SEPARATOR

final char org.jau.net.Uri.QUERY_SEPARATOR = '?'
static

{@value}

Definition at line 284 of file Uri.java.

◆ RESERVED

final String org.jau.net.Uri.RESERVED = punct + "!*\'()@/?#[]"
static

RFC 3986 section 2.2 Reserved Characters (January 2005)

{@value} + alphanum

Definition at line 213 of file Uri.java.

◆ RESERVED_2

final String org.jau.net.Uri.RESERVED_2 = punct + "!*\'()@/?[]"
static

Definition at line 216 of file Uri.java.

◆ scheme

final Encoded org.jau.net.Uri.scheme

Encoded scheme, null if undefined.

Definition at line 1191 of file Uri.java.

◆ SCHEME_SEPARATOR

final char org.jau.net.Uri.SCHEME_SEPARATOR = ':'
static

{@value}

Definition at line 282 of file Uri.java.

◆ schemeSpecificPart

final Encoded org.jau.net.Uri.schemeSpecificPart

Encoded scheme-specific-part, never null.

Definition at line 1194 of file Uri.java.

◆ SSP_LEGAL

final String org.jau.net.Uri.SSP_LEGAL = QUERY_LEGAL
static

Valid charset for RFC 2396 scheme-specific-part, additional to legal alphanum characters.

{@value} + alphanum

Definition at line 268 of file Uri.java.

◆ UNRESERVED

final String org.jau.net.Uri.UNRESERVED = "_-.~"
static

RFC 3986 section 2.3 Unreserved Characters (January 2005)

{@value} + alphanum

Definition at line 201 of file Uri.java.

◆ userInfo

final Encoded org.jau.net.Uri.userInfo

Encoded userinfo part of authority and scheme-specific-part, null if undefined.

Definition at line 1203 of file Uri.java.

◆ USERINFO_LEGAL

final String org.jau.net.Uri.USERINFO_LEGAL = UNRESERVED + punct
static

Valid charset for RFC 2396 authority's user-info, additional to legal alphanum characters.

{@value} + alphanum

Definition at line 229 of file Uri.java.


The documentation for this class was generated from the following file: