Package org.eclipse.core.filesystem
Class URIUtil
java.lang.Object
org.eclipse.core.filesystem.URIUtil
This class provides utility methods for comparing, inspecting, and manipulating
URIs. More specifically, this class is useful for dealing with URIs that represent
file systems represented by the
org.eclipse.core.filesystem.filesystems
extension point. For such URIs the file system implementation can be consulted
to interpret the URI in a way that is not possible at a generic level.- Since:
- org.eclipse.core.filesystem 1.0
- Restriction:
- This class is not intended to be subclassed by clients.
- Restriction:
- This class is not intended to be instantiated by clients.
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Tests two URIs for equality.static String
toDecodedString
(URI uri) Returns a string representation of the URI in a form suitable for human consumption.static IPath
static URI
Converts a String representing a local file system path to aURI
.static URI
Converts a String representing a local file system path to aURI
.static URI
-
Method Details
-
equals
Tests two URIs for equality. This method delegates equality testing to the registered file system for the URIs. If either URI does not have a registered file system, the defaultURI.equals(Object)
method is used.- Parameters:
one
- The first URI to test for equalitytwo
- The second URI to test for equality- Returns:
true
if the first URI is equal to the second, as defined by the file systems for those URIs, andfalse
otherwise.
-
toPath
Returns anIPath
representing thisURI
in the local file system, ornull
if this URI does not represent a file in the local file system.- Parameters:
uri
- The URI to convert- Returns:
- The path representing the provided URI,
null
-
toURI
- Parameters:
path
- The path to convert- Returns:
- The URI representing the provided path
-
toURI
Converts a String representing a local file system path to aURI
. For example, this method can be used to create a URI from the output ofFile.getAbsolutePath()
. The provided path string is always treated as an absolute path.- Parameters:
pathString
- The absolute path string to convert- Returns:
- The URI representing the provided path string
-
toURI
Converts a String representing a local file system path to aURI
. For example, this method can be used to create a URI from the output ofFile.getAbsolutePath()
.The
forceAbsolute
flag controls how this method handles relative paths. If the value istrue
, then the input path is always treated as an absolute path, and the returned URI will be an absolute URI. If the value isfalse
, then a relative path provided as input will result in a relative URI being returned.- Parameters:
pathString
- The path string to convertforceAbsolute
- iftrue
the path is treated as an absolute path- Returns:
- The URI representing the provided path string
- Since:
- org.eclipse.core.filesystem 1.2
-
toDecodedString
Returns a string representation of the URI in a form suitable for human consumption.The string returned by this method is equivalent to that returned by the
URI.toString()
method except that all sequences of escaped octets are decoded.- Parameters:
uri
- The URI to return in string form- Returns:
- the string form of the URI
- Since:
- org.eclipse.core.filesystem 1.2
-