Class MappedURLHandler

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getComposedPath​(java.net.URL url)
      Composes the host and path of a URL together into a single stream; this is useful when processing file system-like URLs that do not use a host.
      static void install()
      Installs all custom protocol handlers.
      protected java.net.URLConnection mapConnection​(java.net.URL sourceURL, java.net.URL mappedURL)
      Returns a URLConnection for the mapped URL.
      protected java.net.URL mapURL​(java.net.URL sourceURL)
      Maps a URL in the handled protocol to one of the underlying URLs.
      protected java.net.URLConnection openConnection​(java.net.URL sourceURL)  
      static java.lang.String removeRelativePathComponents​(java.lang.String path)
      Removes .
      • Methods inherited from class java.net.URLStreamHandler

        equals, getDefaultPort, getHostAddress, hashCode, hostsEqual, openConnection, parseURL, sameFile, setURL, setURL, toExternalForm
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MappedURLHandler

        public MappedURLHandler()
    • Method Detail

      • openConnection

        protected final java.net.URLConnection openConnection​(java.net.URL sourceURL)
                                                       throws java.io.IOException
        Specified by:
        openConnection in class java.net.URLStreamHandler
        Throws:
        java.io.IOException
      • mapURL

        protected java.net.URL mapURL​(java.net.URL sourceURL)
                               throws java.io.IOException
        Maps a URL in the handled protocol to one of the underlying URLs. The base class returns the original URL.
        Parameters:
        sourceURL - a URL in the protocol handled by this handler
        Returns:
        a URL using another protocol that maps to the same resource as this handler, or null
        Throws:
        java.io.IOException - if an I/O error occurs while composing the new URL
      • mapConnection

        protected java.net.URLConnection mapConnection​(java.net.URL sourceURL,
                                                       java.net.URL mappedURL)
                                                throws java.io.IOException
        Returns a URLConnection for the mapped URL. The base class returns mappedURL.openConnection().
        Parameters:
        sourceURL - the original URL
        mappedURL - the mapped URL returned from mapURL(java.net.URL)
        Returns:
        a connection for the URL
        Throws:
        java.io.IOException - if an I/O error occurs or the mapped URL is null
      • install

        public static void install()
        Installs all custom protocol handlers. There is normally no need to call this as Strange Eons will install the handler during initialization.
      • getComposedPath

        public static java.lang.String getComposedPath​(java.net.URL url)
        Composes the host and path of a URL together into a single stream; this is useful when processing file system-like URLs that do not use a host.
        Parameters:
        url - the URL to compose
        Returns:
        the host and path, concatenated and separated by a slash, or null if null was passed in
      • removeRelativePathComponents

        public static java.lang.String removeRelativePathComponents​(java.lang.String path)
        Removes . and .. segments from a URL path. This can be used on the concatenation of an absolute path with a path with one or more relative segments to produce an equivalent absolute path.
        Parameters:
        path - the concatenated path
        Returns:
        an absolute path