Class Handler

  • All Implemented Interfaces:
    IJarURLStreamHandler

    public class Handler
    extends java.net.URLStreamHandler
    implements IJarURLStreamHandler
    The XJar URLStreamHandler.

    This class must be named Handler for the default system handler search mechanism to function. Normally you will not use this class directly; XURLStreamHandlerFactory documents how to globally install Xjar support. However, you can employ XJar using just this class:

       Handler xjar = new Handler(...);
       URL url = new URL (..., xjar);
     

    Author:
    Christopher Mindus
    • Field Summary

      Fields 
      Modifier and TypeFieldDescription
      static booleanDEBUG
      Debug flag, default false.
    • Constructor Summary

      Constructors 
      ConstructorDescription
      Handler()
      Construct a new Handler.
      Handler​(XJarFile jarFile)
      Handler construction for an open Memory Jar.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      IJarFilegetJarFile()
      Gets the IJarFile from the handler.
      protected java.net.URLConnectionopenConnection​(java.net.URL url)
      Open an XJarURLConnection to the specified URL.
      • 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
    • Field Detail

      • DEBUG

        public static boolean DEBUG
        Debug flag, default false.
    • Constructor Detail

      • Handler

        public Handler()
        Construct a new Handler.
      • Handler

        public Handler​(XJarFile jarFile)
        Handler construction for an open Memory Jar.
        Parameters:
        jarFile - The Jar file to use.
    • Method Detail

      • getJarFile

        public IJarFile getJarFile()
        Gets the IJarFile from the handler.
        Specified by:
        getJarFile in interface IJarURLStreamHandler
        Returns:
        The Jar file, or null if handler did not specify an IJarFile.
      • openConnection

        protected java.net.URLConnection openConnection​(java.net.URL url)
                                                 throws java.io.IOException
        Open an XJarURLConnection to the specified URL.
        Specified by:
        openConnection in class java.net.URLStreamHandler
        Parameters:
        url - The URL to which to connect.
        Throws:
        java.io.IOException