URI.Fragment, URI.Hierarchical, URI.Opaque, URI.URIPool| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
authority
The authority of the hierarchical URI.
|
protected java.lang.String |
device
The device of the hierarchical URI.
|
protected int |
flags
Bit flags for the results of all the boolean no-argument methods.
|
protected static int |
HAS_ABSOLUTE_PATH
The
flags bit for representing URI.hasAbsolutePath(). |
protected static int |
HAS_EMPTY_PATH
The
flags bit for representing URI.hasEmptyPath(). |
protected static int |
HAS_PATH
The
flags bits for representing URI.hasPath(). |
protected static int |
HAS_RELATIVE_PATH
The
flags bit for representing URI.hasRelativePath(). |
protected static int |
HAS_TRAILING_PATH_SEPARATOR
The
flags bit for representing URI.hasTrailingPathSeparator(). |
protected static int |
IS_ARCHIVE
The
flags bit for representing URI.isArchive(). |
protected static int |
IS_CURRENT_DOCUMENT_REFERENCE
The
flags bit for representing URI.isCurrentDocumentReference(). |
protected static int |
IS_FILE
The
flags bit for representing URI.isFile(). |
protected static int |
IS_PLATFORM
The
flags bit for representing URI.isPlatform(). |
protected static int |
IS_PLATFORM_PLUGIN
The
flags bit for representing URI.isPlatformPlugin(). |
protected static int |
IS_PLATFORM_RESOURCE
The
flags bit for representing URI.isPlatformResource(). |
protected static int |
IS_PREFIX
The
flags bit for representing URI.isPrefix(). |
protected java.lang.String |
query
The query of the hierarchical URI.
|
protected java.lang.String |
scheme
The scheme of the hierarchical URIs.
|
protected java.lang.String[] |
segments
The segments of the hierarchical URI.
|
protected java.lang.ref.WeakReference<java.lang.String> |
toString
A weakly cached reference to the string representation.
|
ALPHA_HI, ALPHA_LO, ALPHANUM_HI, ALPHANUM_LO, ARCHIVE_IDENTIFIER, ARCHIVE_SCHEMES, ARCHIVE_SEPARATOR, AUTHORITY_SEPARATOR, AUTHORITY_SEPARATOR_HASH_CODE, DEBUG, DEVICE_IDENTIFIER, DIGIT_HI, DIGIT_LO, ENCODE_PLATFORM_RESOURCE_URIS, ESCAPE, FILE_EXTENSION_SEPARATOR, FRAGMENT_FIRST_SEPARATOR, FRAGMENT_LAST_SEPARATOR, FRAGMENT_NONE, FRAGMENT_SEPARATOR, hashCode, HEX_DIGITS, HEX_HI, HEX_LO, MAJOR_SEPARATOR_HI, MAJOR_SEPARATOR_LO, NO_SEGMENTS, ONE_EMPTY_SEGMENT, ONE_SELF_SEGMENT, PATH_CHAR_HI, PATH_CHAR_LO, PLATFORM_SEGMENT_RESERVED_HI, PLATFORM_SEGMENT_RESERVED_LO, POOL, PORT_SEPARATOR, QUERY_SEPARATOR, RESERVED_HI, RESERVED_LO, SCHEME_ARCHIVE, SCHEME_ARCHIVE_HASH_CODE, SCHEME_FILE, SCHEME_FILE_HASH_CODE, SCHEME_HTTP, SCHEME_HTTP_HASH_CODE, SCHEME_JAR, SCHEME_JAR_HASH_CODE, SCHEME_PLATFORM, SCHEME_PLATFORM_HASH_CODE, SCHEME_SEPARATOR, SCHEME_ZIP, SCHEME_ZIP_HASH_CODE, SEGMENT_CHAR_HI, SEGMENT_CHAR_LO, SEGMENT_EMPTY, SEGMENT_END_HI, SEGMENT_END_LO, SEGMENT_PARENT, SEGMENT_PLUGIN, SEGMENT_RESOURCE, SEGMENT_SELF, SEGMENT_SEPARATOR, UNRESERVED_HI, UNRESERVED_LO, URIC_HI, URIC_LO, USER_INFO_SEPARATOR| Modifier | Constructor and Description |
|---|---|
protected |
Hierarchical(int hashCode,
boolean hierarchical,
java.lang.String scheme,
java.lang.String authority,
java.lang.String device,
boolean absolutePath,
java.lang.String[] segments,
java.lang.String query)
Creates an instance from the components, computing the
flags bits. |
| Modifier and Type | Method and Description |
|---|---|
protected static int |
accumulate(java.lang.String[] stack,
int sp,
java.lang.String segment,
boolean preserveRootParents) |
URI |
appendFileExtension(java.lang.String fileExtension)
Returns the URI formed by appending a period (".") followed by the
specified file extension to the last path segment of this URI, if it is
hierarchical with a non-empty path ending in a non-empty segment;
otherwise, this URI is returned unchanged.
|
URI |
appendQuery(java.lang.String query)
Returns the URI formed from this URI and the given query.
|
URI |
appendSegment(java.lang.String segment)
Returns the URI formed by appending the specified segment on to the end
of the path of this URI, if hierarchical; this URI unchanged,
otherwise.
|
URI |
appendSegments(java.lang.String[] segments)
Returns the URI formed by appending the specified segments on to the
end of the path of this URI, if hierarchical; this URI unchanged,
otherwise.
|
java.lang.String |
authority()
If this is a hierarchical URI with an authority component, returns it;
null otherwise. |
protected void |
cacheString(java.lang.String string) |
protected java.lang.String[] |
collapseSegments(boolean preserveRootParents) |
URI |
deresolve(URI base,
boolean preserveRootParents,
boolean anyRelPath,
boolean shorterRelPath)
Finds an absolute URI that, when resolved against the given
base absolute hierarchical URI using resolve, will yield this absolute URI. |
java.lang.String |
device()
If this is a hierarchical URI with a device component, returns it;
null otherwise. |
java.lang.String |
devicePath()
If this is a hierarchical URI with a path, returns a string
representation of the path, including the authority and the
device component;
null otherwise. |
java.lang.String |
fileExtension()
If this is a hierarchical URI whose path includes a file extension,
that file extension is returned; null otherwise.
|
protected java.lang.String[] |
findRelativePath(URI base,
boolean preserveRootParents) |
protected void |
flushCachedString() |
protected java.lang.String |
getCachedString() |
boolean |
hasAbsolutePath()
Returns
true if this is a hierarchical URI with an
absolute path, or false if it is non-hierarchical, has no
path, or has a relative path. |
boolean |
hasAuthority()
Returns
true if this is a hierarchical URI with an authority
component; false otherwise. |
protected boolean |
hasCollapsableSegments(boolean preserveRootParents) |
boolean |
hasDevice()
Returns
true if this is a hierarchical URI with a device
component; false otherwise. |
protected boolean |
hasDeviceOrPath() |
boolean |
hasEmptyPath()
Returns
true if this is a hierarchical URI with an empty
relative path; false otherwise. |
boolean |
hasPath()
Returns
true if this is a hierarchical URI with an
absolute or relative path; false otherwise. |
boolean |
hasQuery()
Returns
true if this is a hierarchical URI with a query
component; false otherwise. |
boolean |
hasRelativePath()
Returns
true if this is a hierarchical URI with a relative
path, or false if it is non-hierarchical, has no path, or
has an absolute path. |
boolean |
hasTrailingPathSeparator()
Returns
true if this is a hierarchical URI that has a path
that ends with a trailing separator; false otherwise. |
java.lang.String |
host()
If this is a hierarchical URI with an authority component that has a
host portion, returns it;
null otherwise. |
boolean |
isArchive()
Returns
true if this is an archive URI. |
protected boolean |
isBase() |
boolean |
isCurrentDocumentReference()
Returns
true if this is a current document reference; that
is, if it is a relative hierarchical URI with no authority, device or
query components, and no path segments; false is returned
otherwise. |
boolean |
isEmpty()
|
boolean |
isFile()
Returns
true if this is a hierarchical URI that may refer
directly to a locally accessible file. |
boolean |
isHierarchical()
Returns
true if this a a hierarchical URI, or
false if it is of the generic form. |
boolean |
isPlatform()
Returns
true if this is a platform URI, that is, an absolute,
hierarchical URI, with "platform" scheme, no authority, and at least two
segments; false is returned otherwise. |
boolean |
isPlatformPlugin()
Returns
true if this is a platform plug-in URI, that is,
a platform URI whose first segment is "plugin";
false is returned otherwise. |
boolean |
isPlatformResource()
Returns
true if this is a platform resource URI, that is,
a platform URI whose first segment is "resource";
false is returned otherwise. |
boolean |
isPrefix()
Returns
true if this is a hierarchical URI that ends in a
slash; that is, it has a trailing path separator or is the root
absolute path, and has no query and no fragment; false
is returned otherwise. |
boolean |
isRelative()
Returns
true if this is a relative URI, or
false if it is an absolute URI. |
java.lang.String |
lastSegment()
Returns the last segment in the segment array, or
null. |
protected boolean |
matches(int validate,
boolean hierarchical,
java.lang.String scheme,
java.lang.String authority,
java.lang.String device,
boolean absolutePath,
java.lang.String[] segments,
java.lang.String query) |
protected boolean |
matches(java.lang.String string) |
protected boolean |
matches(java.lang.String base,
java.lang.String path) |
protected java.lang.String[] |
mergePath(URI base,
boolean preserveRootParents) |
java.lang.String |
path()
If this is a hierarchical URI with a path, returns a string
representation of the path;
null otherwise. |
java.lang.String |
port()
If this is a hierarchical URI with an authority component that has a
port portion, returns it;
null otherwise. |
java.lang.String |
query()
If this is a hierarchical URI with a query component, returns it;
null otherwise. |
protected java.lang.String[] |
rawSegments() |
URI |
replacePrefix(URI oldPrefix,
URI newPrefix)
If this is a hierarchical URI reference and
oldPrefix is a
prefix of it, this returns the URI formed by replacing it by
newPrefix; null otherwise. |
URI |
resolve(URI base,
boolean preserveRootParents)
Resolves this URI reference against a
base absolute
hierarchical URI, returning the resulting absolute URI. |
java.lang.String |
scheme()
If this is an absolute URI, returns the scheme component;
null otherwise. |
java.lang.String |
segment(int i)
Provides fast, indexed access to individual segments in the path
segment array.
|
int |
segmentCount()
Returns the number of elements in the segment array that would be
returned by
segments. |
java.lang.String[] |
segments()
If this is a hierarchical URI with a path, returns an array containing
the segments of the path; an empty array otherwise.
|
protected boolean |
segmentsEqual(URI uri) |
java.util.List<java.lang.String> |
segmentsList()
Returns an unmodifiable list containing the same segments as the array
returned by
segments. |
java.lang.String |
toFileString()
|
java.lang.String |
toPlatformString(boolean decode)
If this is a platform URI, as determined by
URI.isPlatform(), returns
the workspace-relative or plug-in-based path to the resource, optionally
decoding the segments in the process. |
java.lang.String |
toString() |
URI |
trimFileExtension()
If this URI has a non-null
fileExtension,
returns the URI formed by removing it; this URI unchanged, otherwise. |
URI |
trimQuery()
If this URI has a non-null
query, returns the URI
formed by removing it; this URI unchanged, otherwise. |
URI |
trimSegments(int i)
Returns the URI formed by trimming the specified number of segments
(including empty segments, such as one representing a trailing
separator) from the end of the path of this URI, if hierarchical;
otherwise, this URI is returned unchanged.
|
java.lang.String |
userInfo()
If this is a hierarchical URI with an authority component that has a
user info portion, returns it;
null otherwise. |
appendEscaped, appendFragment, contains, createDeviceURI, createFileURI, createGenericURI, createHierarchicalURI, createHierarchicalURI, createHierarchicalURI, createPlatformPluginURI, createPlatformResourceURI, createPlatformResourceURI, createURI, createURI, createURI, createURIWithCache, decode, deresolve, encode, encodeAuthority, encodeFragment, encodeOpaquePart, encodeQuery, encodeSegment, encodeURI, equals, firstInvalidSegment, fragment, hasFragment, hashCode, hasOpaquePart, highBitmask, highBitmask, highBitmask, isArchiveScheme, isEscaped, lowBitmask, lowBitmask, lowBitmask, main, matches, opaquePart, rawAppendFragment, resolve, splitInternFragment, trimFragment, unescape, validArchiveAuthority, validateURI, validAuthority, validDevice, validFragment, validJarAuthority, validOpaquePart, validQuery, validScheme, validSegment, validSegments, valueOfprotected static final int HAS_ABSOLUTE_PATH
flags bit for representing URI.hasAbsolutePath().protected static final int HAS_RELATIVE_PATH
flags bit for representing URI.hasRelativePath().protected static final int HAS_EMPTY_PATH
flags bit for representing URI.hasEmptyPath().protected static final int IS_CURRENT_DOCUMENT_REFERENCE
flags bit for representing URI.isCurrentDocumentReference().protected static final int IS_FILE
flags bit for representing URI.isFile().protected static final int IS_PLATFORM
flags bit for representing URI.isPlatform().protected static final int IS_PLATFORM_RESOURCE
flags bit for representing URI.isPlatformResource().protected static final int IS_PLATFORM_PLUGIN
flags bit for representing URI.isPlatformPlugin().protected static final int IS_ARCHIVE
flags bit for representing URI.isArchive().protected static final int HAS_TRAILING_PATH_SEPARATOR
flags bit for representing URI.hasTrailingPathSeparator().protected static final int IS_PREFIX
flags bit for representing URI.isPrefix().protected static final int HAS_PATH
flags bits for representing URI.hasPath().protected final int flags
protected final java.lang.String scheme
protected final java.lang.String authority
protected final java.lang.String device
protected final java.lang.String[] segments
protected final java.lang.String query
protected java.lang.ref.WeakReference<java.lang.String> toString
protected Hierarchical(int hashCode,
boolean hierarchical,
java.lang.String scheme,
java.lang.String authority,
java.lang.String device,
boolean absolutePath,
java.lang.String[] segments,
java.lang.String query)
flags bits.
Assertions are used to validate the integrity of the result.
I.e., all components must be interned and the hash code must be equal to the hash code of the toString().public boolean isRelative()
URItrue if this is a relative URI, or
false if it is an absolute URI.isRelative in class URIpublic boolean isHierarchical()
URItrue if this a a hierarchical URI, or
false if it is of the generic form.isHierarchical in class URIpublic boolean hasAuthority()
URItrue if this is a hierarchical URI with an authority
component; false otherwise.hasAuthority in class URIpublic boolean hasDevice()
URItrue if this is a hierarchical URI with a device
component; false otherwise.public boolean hasPath()
URItrue if this is a hierarchical URI with an
absolute or relative path; false otherwise.protected boolean hasDeviceOrPath()
hasDeviceOrPath in class URIpublic boolean hasAbsolutePath()
URItrue if this is a hierarchical URI with an
absolute path, or false if it is non-hierarchical, has no
path, or has a relative path.hasAbsolutePath in class URIpublic boolean hasRelativePath()
URItrue if this is a hierarchical URI with a relative
path, or false if it is non-hierarchical, has no path, or
has an absolute path.hasRelativePath in class URIpublic boolean hasEmptyPath()
URItrue if this is a hierarchical URI with an empty
relative path; false otherwise.
Note that !hasEmpty() does not imply that this
URI has any path segments; however, hasRelativePath &&
!hasEmptyPath() does.
hasEmptyPath in class URIpublic boolean hasQuery()
URItrue if this is a hierarchical URI with a query
component; false otherwise.public boolean isCurrentDocumentReference()
URItrue if this is a current document reference; that
is, if it is a relative hierarchical URI with no authority, device or
query components, and no path segments; false is returned
otherwise.isCurrentDocumentReference in class URIpublic boolean isEmpty()
URIisEmpty in class URIURI.isCurrentDocumentReference()public boolean isFile()
URItrue if this is a hierarchical URI that may refer
directly to a locally accessible file. This is considered to be the
case for a file-scheme absolute URI, or for a relative URI with no query;
false is returned otherwise.public boolean isPlatform()
URItrue if this is a platform URI, that is, an absolute,
hierarchical URI, with "platform" scheme, no authority, and at least two
segments; false is returned otherwise.isPlatform in class URIpublic boolean isPlatformResource()
URItrue if this is a platform resource URI, that is,
a platform URI whose first segment is "resource";
false is returned otherwise.isPlatformResource in class URIURI.isPlatform()public boolean isPlatformPlugin()
URItrue if this is a platform plug-in URI, that is,
a platform URI whose first segment is "plugin";
false is returned otherwise.isPlatformPlugin in class URIURI.isPlatform()public boolean isArchive()
URItrue if this is an archive URI. If so, it is also
hierarchical, with an authority (consisting of an absolute URI followed
by "!"), no device, and an absolute path.protected boolean segmentsEqual(URI uri)
segmentsEqual in class URIpublic java.lang.String scheme()
URInull otherwise.public java.lang.String authority()
URInull otherwise.public java.lang.String userInfo()
URInull otherwise.public java.lang.String host()
URInull otherwise.public java.lang.String port()
URInull otherwise.public java.lang.String device()
URInull otherwise.public java.lang.String[] segments()
URIprotected java.lang.String[] rawSegments()
rawSegments in class URIpublic java.util.List<java.lang.String> segmentsList()
URIsegments.segmentsList in class URIpublic int segmentCount()
URIsegments.segmentCount in class URIpublic java.lang.String segment(int i)
URIpublic java.lang.String lastSegment()
URInull.lastSegment in class URIpublic java.lang.String path()
URInull otherwise. The path
consists of a leading segment separator character (a slash), if the
path is absolute, followed by the slash-separated path segments. If
this URI has a separate device
component, it is not included in the path.public java.lang.String devicePath()
URInull otherwise.
If there is no authority, the format of this string is:
device/pathSegment1/pathSegment2...
If there is an authority, it is:
//authority/device/pathSegment1/pathSegment2...
For an archive URI, it's just:
authority/pathSegment1/pathSegment2...
devicePath in class URIpublic java.lang.String query()
URInull otherwise.public URI appendQuery(java.lang.String query)
URIappendQuery in class URIpublic URI trimQuery()
URIquery, returns the URI
formed by removing it; this URI unchanged, otherwise.public URI resolve(URI base, boolean preserveRootParents)
URIbase absolute
hierarchical URI, returning the resulting absolute URI. If already
absolute, the URI itself is returned. URI resolution is described in
detail in section 5.2 of RFC
2396, "Resolving Relative References to Absolute Form."
During resolution, empty segments, self references ("."), and parent references ("..") are interpreted, so that they can be removed from the path. Step 6(g) gives a choice of how to handle the case where parent references point to a path above the root: the offending segments can be preserved or discarded. This method can do either.
protected java.lang.String[] mergePath(URI base, boolean preserveRootParents)
protected static int accumulate(java.lang.String[] stack,
int sp,
java.lang.String segment,
boolean preserveRootParents)
public URI deresolve(URI base, boolean preserveRootParents, boolean anyRelPath, boolean shorterRelPath)
URIbase absolute hierarchical URI using resolve, will yield this absolute URI.
If base is non-hierarchical or is relative,
or this is non-hierarchical or is relative,
this will be returned.deresolve in class URIpreserveRootParents - the boolean argument to resolve(URI,
boolean) for which the returned URI should resolve to this URI.anyRelPath - if true, the returned URI's path (if
any) will be relative, if possible. If false, the form of
the result's path will depend upon the next parameter.shorterRelPath - if anyRelPath is false
and this parameter is true, the returned URI's path (if
any) will be relative, if one can be found that is no longer (by number
of segments) than the absolute path. If both anyRelPath
and this parameter are false, it will be absolute.protected boolean hasCollapsableSegments(boolean preserveRootParents)
protected java.lang.String[] findRelativePath(URI base, boolean preserveRootParents)
protected java.lang.String[] collapseSegments(boolean preserveRootParents)
collapseSegments in class URIprotected void cacheString(java.lang.String string)
cacheString in class URIprotected void flushCachedString()
flushCachedString in class URIprotected java.lang.String getCachedString()
getCachedString in class URIpublic java.lang.String toString()
toString in class java.lang.Objectprotected boolean matches(int validate,
boolean hierarchical,
java.lang.String scheme,
java.lang.String authority,
java.lang.String device,
boolean absolutePath,
java.lang.String[] segments,
java.lang.String query)
protected boolean matches(java.lang.String base,
java.lang.String path)
public java.lang.String toFileString()
URIisFile, decodes and formats
the URI as a pathname to that file; returns null otherwise.
If there is no authority, the format of this string is:
device/pathSegment1/pathSegment2...
If there is an authority, it is:
//authority/device/pathSegment1/pathSegment2...
However, the character used as a separator is system-dependent and
obtained from File.separatorChar.
toFileString in class URIpublic java.lang.String toPlatformString(boolean decode)
URIURI.isPlatform(), returns
the workspace-relative or plug-in-based path to the resource, optionally
decoding the segments in the process.toPlatformString in class URIURI.createPlatformResourceURI(String, boolean),
URI.createPlatformPluginURI(java.lang.String, boolean)public URI appendSegment(java.lang.String segment)
URIappendSegment in class URIpublic URI appendSegments(java.lang.String[] segments)
URIappendSegments in class URIsegments - an array of non-null strings, each representing one
segment of the path. If desired, a trailing separator should be
represented by an empty-string segment as the last element of the
array.public URI trimSegments(int i)
URINote that if all segments are trimmed from an absolute path, the root absolute path remains.
trimSegments in class URIi - the number of segments to be trimmed in the returned URI. If
less than 1, this URI is returned unchanged; if equal to or greater
than the number of segments in this URI's path, all segments are
trimmed.public boolean hasTrailingPathSeparator()
URItrue if this is a hierarchical URI that has a path
that ends with a trailing separator; false otherwise.
A trailing separator is represented as an empty segment as the last segment in the path; note that this definition does not include the lone separator in the root absolute path.
hasTrailingPathSeparator in class URIpublic java.lang.String fileExtension()
URIfileExtension in class URIpublic URI appendFileExtension(java.lang.String fileExtension)
URIThe extension is appended regardless of whether the segment already contains an extension.
appendFileExtension in class URIpublic URI trimFileExtension()
URIfileExtension,
returns the URI formed by removing it; this URI unchanged, otherwise.trimFileExtension in class URIpublic boolean isPrefix()
URItrue if this is a hierarchical URI that ends in a
slash; that is, it has a trailing path separator or is the root
absolute path, and has no query and no fragment; false
is returned otherwise.public URI replacePrefix(URI oldPrefix, URI newPrefix)
URIoldPrefix is a
prefix of it, this returns the URI formed by replacing it by
newPrefix; null otherwise.
In order to be a prefix, the oldPrefix's
isPrefix must return true, and it must
match this URI's scheme, authority, and device. Also, the paths must
match, up to prefix's end.
replacePrefix in class URICopyright © 2018. Licensed under the Eclipse Public License v1.0. All rights reserved.
Submit a bug or feature