Class Resolver

  • public class Resolver
    extends Object
    A class to provide some utility methods in support of some protocol I/O capabilities.
    • Method Detail

      • setProtocol

        public static void setProtocol​(Protocol oProtocol)
        Sets (adds) the given protocol to the list of protocol handlers.
        oProtocol - a protocol handler. Subsequent to this operation, the I/O of any URL whose scheme matches the given protocol will be routed to the given protocol handler.
      • resetProtocols

        public static void resetProtocols()
        Uninstall all protocol handlers. It is normally not necessary to make this call, as protocol handlers are automatically deleted on exit. However, when a protocol handler is in a DLL that is dynamically loaded, it is possible for that DLL to be unloaded before the automatic deletion takes place, leading to a crash. In that case the DLL must call ResetProtocols just prior to unloading (for example in the destructor of a global variable).
      • getProtocol

        public static Protocol getProtocol​(String sScheme)
        Get the currently installed protocol handler associated with the given scheme.
        sScheme - a URL's scheme.
        the matching protocol handler.
      • crackUrl

        public static void crackUrl​(String sUrl,
                                    StringHolder sScheme,
                                    StringHolder sUser,
                                    StringHolder sPwd,
                                    StringHolder sHost,
                                    StringHolder sPort,
                                    StringHolder sPath)
        Crack an url into its constituent parts. The URL is cracked from the following rule:
        sUrl - the URL to crack.
        sScheme - the cracked URL's scheme.
        sUser - the cracked URL's user, if any.
        sPwd - the cracked URL's password, if any.
        sHost - the cracked URL's host.
        sPort - the cracked URL's port, if any.
        sPath - the cracked URL's path, if any.
      • canonUrl

        public static String canonUrl​(String sScheme,
                                      String sHost,
                                      String sPort,
                                      String sPath)
        Canon(ize) an url into its constituent parts. The URL is canonized into the following rule:
        sScheme - the URL's scheme.
        sHost - the URL's host.
        sPort - the URL's port, if any.
        sPath - the URL's path, if any.
        The canonized URL.
      • urlEncode

        public static String urlEncode​(String sUrl)
        URL encode a string
        sUrl - string to be encoded
        URL encoded string
      • urlDecode

        public static String urlDecode​(String sUrl)
        Decode a URL encoded string
        sUrl - string to be decoded
        Decoded string