URI.Fragment, URI.Hierarchical, URI.Opaque, URI.URIPool| Modifier and Type | Field and Description |
|---|---|
protected java.lang.CharSequence |
fragment
The representation of the fragment.
|
protected URI |
uri
The
base URI. |
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 |
Fragment(int hashCode,
URI uri,
java.lang.CharSequence fragment)
Creates an instance from the components.
|
| Modifier and Type | Method and Description |
|---|---|
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 |
appendFragment(java.lang.String fragment)
Returns the URI formed from this URI and the given fragment.
|
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 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. |
boolean |
equals(java.lang.Object object) |
java.lang.String |
fileExtension()
If this is a hierarchical URI whose path includes a file extension,
that file extension is returned; null otherwise.
|
java.lang.String |
fragment()
If this URI has a fragment component, returns it;
null otherwise. |
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. |
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 |
hasFragment()
Returns
true if this URI has a fragment component;
false otherwise. |
int |
hashCode()
If the hash code is
0 then most likely we've got a pending lazy LazyFragmentInitializer. |
boolean |
hasOpaquePart()
Returns
true if this is a non-hierarchical URI with an
opaque part component; 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 |
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. |
java.lang.String |
opaquePart()
If this is a non-hierarchical URI, returns the opaque part component;
null otherwise. |
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 |
trimFragment()
If this URI has a non-null
fragment, 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, cacheString, 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, flushCachedString, getCachedString, highBitmask, highBitmask, highBitmask, isArchiveScheme, isEscaped, isPrefix, lowBitmask, lowBitmask, lowBitmask, main, matches, matches, matches, matches, rawAppendFragment, resolve, splitInternFragment, unescape, validArchiveAuthority, validateURI, validAuthority, validDevice, validFragment, validJarAuthority, validOpaquePart, validQuery, validScheme, validSegment, validSegments, valueOfprotected java.lang.CharSequence fragment
split interned.protected Fragment(int hashCode,
URI uri,
java.lang.CharSequence fragment)
split 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 hasOpaquePart()
URItrue if this is a non-hierarchical URI with an
opaque part component; false otherwise.hasOpaquePart 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 hasFragment()
URItrue if this URI has a fragment component;
false otherwise.hasFragment in class URIpublic 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 opaquePart()
URInull otherwise.opaquePart in class URIpublic 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 java.lang.String fragment()
URInull otherwise.public URI appendFragment(java.lang.String fragment)
URIappendFragment in class URIpublic URI trimFragment()
URIfragment, returns the URI
formed by removing it; this URI unchanged, otherwise.trimFragment in class URIpublic 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.
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 java.lang.String[] collapseSegments(boolean preserveRootParents)
collapseSegments in class URIpublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
0 then most likely we've got a pending lazy LazyFragmentInitializer.public boolean equals(java.lang.Object object)
equals in class java.lang.Objectpublic 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 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