Class URIUtil

java.lang.Object
org.eclipse.core.filesystem.URIUtil

public class URIUtil extends Object
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 Details

    • equals

      public static boolean equals(URI one, URI two)
      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 default URI.equals(Object) method is used.
      Parameters:
      one - The first URI to test for equality
      two - 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, and false otherwise.
    • toPath

      public static IPath toPath(URI uri)
      Returns an IPath representing this URI in the local file system, or null 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

      public static URI toURI(IPath path)
      Converts an IPath representing a local file system path to a URI.
      Parameters:
      path - The path to convert
      Returns:
      The URI representing the provided path
    • toURI

      public static URI toURI(String pathString)
      Converts a String representing a local file system path to a URI. For example, this method can be used to create a URI from the output of File.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

      public static URI toURI(String pathString, boolean forceAbsolute)
      Converts a String representing a local file system path to a URI. For example, this method can be used to create a URI from the output of File.getAbsolutePath().

      The forceAbsolute flag controls how this method handles relative paths. If the value is true, then the input path is always treated as an absolute path, and the returned URI will be an absolute URI. If the value is false, then a relative path provided as input will result in a relative URI being returned.

      Parameters:
      pathString - The path string to convert
      forceAbsolute - if true the path is treated as an absolute path
      Returns:
      The URI representing the provided path string
      Since:
      org.eclipse.core.filesystem 1.2
    • toDecodedString

      public static String toDecodedString(URI uri)
      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