Interface URLConverter

All Known Implementing Classes:
BundleURLConverter

public interface URLConverter
The interface of the service that allows client-defined protocol URLs to be converted to native file URLs on the local file system.

Clients may implement this interface.

Since:
3.1
  • Method Summary

    Modifier and Type
    Method
    Description
    resolve(URL url)
    Converts a URL that uses a client-defined protocol into a URL that uses a protocol which is native to the Java class library (file, jar, http, etc).
    Converts a URL that uses a user-defined protocol into a URL that uses the file protocol.
  • Method Details

    • toFileURL

      URL toFileURL(URL url) throws IOException
      Converts a URL that uses a user-defined protocol into a URL that uses the file protocol. The contents of the URL may be extracted into a cache on the file-system in order to get a file URL.

      If the protocol for the given URL is not recognized by this converter, the original URL is returned as-is.

      Parameters:
      url - the original URL
      Returns:
      the converted file URL or the original URL passed in if it is not recognized by this converter
      Throws:
      IOException - if an error occurs during the conversion
      Since:
      3.2
    • resolve

      URL resolve(URL url) throws IOException
      Converts a URL that uses a client-defined protocol into a URL that uses a protocol which is native to the Java class library (file, jar, http, etc).

      Note however that users of this API should not assume too much about the results of this method. While it may consistently return a file: URL in certain installation configurations, others may result in jar: or http: URLs.

      If the protocol is not recognized by this converter, then the original URL is returned as-is.

      Parameters:
      url - the original URL
      Returns:
      the resolved URL or the original if the protocol is unknown to this converter
      Throws:
      IOException - if unable to resolve URL
      IOException - if an error occurs during the resolution
      Since:
      3.2