/** * Default constructor. * * @param classLoader the class loader to load the directory listings. * @throws NullPointerException if {@code classLoader} is <code>null</code>. */ public ClassPathDirectoryListing(final ClassLoader classLoader) throws NullPointerException { this(new ClassPathContext(classLoader, null)); }
/** * Opens the stream to the resource. * * @param resource the resource whose stream is requested. * @return the stream to the resource or <code>null</code> if the resource * cannot be found on the class path. If a stream is returned, the * client is responsible to close that stream. */ public InputStream getResourceAsStream(final String resource) { final URL url = getResource(resource); if (url != null) { try { return url.openStream(); } catch (final IOException e) { // return null; } } return null; }
final URL resourcePathUrl = context.getResource(resourcePath); if (resourcePathUrl == null)