public URLStreamHandler createURLStreamHandler(final String protocol) { final Collection<URLStreamHandlerFactory> factories = this.factories; synchronized (factories) { for (final URLStreamHandlerFactory f : factories) { final URLStreamHandler handler = f.createURLStreamHandler(protocol); if (handler != null) { return handler; } } } return null; }
/** * Creates a new URLClassPath for the given URLs. The URLs will be searched in the order specified * for classes and resources. A URL ending with a '/' is assumed to refer to a directory. * Otherwise, the URL is assumed to refer to a JAR file. * * @param urls the directory and JAR file URLs to search for classes and resources * @param factory the URLStreamHandlerFactory to use when creating new URLs */ public URLClassPath(URL[] urls, URLStreamHandlerFactory factory) { for (int i = 0; i < urls.length; i++) { path.add(urls[i]); } push(urls); if (factory != null) { jarHandler = factory.createURLStreamHandler("jar"); } }
@Override public URLStreamHandler createURLStreamHandler(String protocol) { return delegate != null ? delegate.createURLStreamHandler(protocol) : null; }