private InputStream locateStreamFromJar(final String uri, final File jarPath)
      throws IOException {
    """
	Finds the specified wildcard-URI resource(s) inside a JAR file and returns an {@link InputStream} to read a bundle
	of matching resources.
	
	@param uri
	Resource(s) URI to match. It cannot be null or empty.
	@param jarPath
	A valid JAR file. It cannot be null.
	@return A valid {@link InputStream} to read the bundle. Clients are responsible of closing this {@link InputStream}
	@throws IOException
	If there's any error reading the JAR file.
    """
    JarFile jarFile = null;
    try {
      LOG.debug("Locating stream from jar: {}", jarPath);
      final WildcardContext wildcardContext = new WildcardContext(uri, jarPath);
      String classPath = FilenameUtils.getPath(uri);

      if (classPath.startsWith(ClasspathUriLocator.PREFIX)) {
        classPath = substringAfter(classPath, ClasspathUriLocator.PREFIX);
      }

      jarFile = open(jarPath);
      final List<JarEntry> jarEntryList = Collections.list(jarFile.entries());
      final List<JarEntry> filteredJarEntryList = new ArrayList<JarEntry>();
      final List<File> allFiles = new ArrayList<File>();
      for (final JarEntry entry : jarEntryList) {
        final String entryName = entry.getName();
        // ignore the parent folder itself and accept only child resources
        final boolean isSupportedEntry = entryName.startsWith(classPath) && !entryName.equals(classPath)
            && accept(entryName, wildcardContext.getWildcard());
        if (isSupportedEntry) {
          allFiles.add(new File(entryName));
          LOG.debug("\tfound jar entry: {}", entryName);
          filteredJarEntryList.add(entry);
        }
      }
      final ByteArrayOutputStream out = new ByteArrayOutputStream();

      triggerWildcardExpander(allFiles, wildcardContext);
      for (final JarEntry entry : filteredJarEntryList) {
        final InputStream is = jarFile.getInputStream(entry);
        IOUtils.copy(is, out);
        is.close();
      }
      return new BufferedInputStream(new ByteArrayInputStream(out.toByteArray()));
    } finally {
      IOUtils.closeQuietly(jarFile);
    }
  }
private InputStream locateStreamFromJar(final String uri, final File jarPath)
      throws IOException {
    JarFile jarFile = null;
    try {
      LOG.debug("Locating stream from jar: {}", jarPath);
      final WildcardContext wildcardContext = new WildcardContext(uri, jarPath);
      String classPath = FilenameUtils.getPath(uri);

      if (classPath.startsWith(ClasspathUriLocator.PREFIX)) {
        classPath = substringAfter(classPath, ClasspathUriLocator.PREFIX);
      }

      jarFile = open(jarPath);
      final List<JarEntry> jarEntryList = Collections.list(jarFile.entries());
      final List<JarEntry> filteredJarEntryList = new ArrayList<JarEntry>();
      final List<File> allFiles = new ArrayList<File>();
      for (final JarEntry entry : jarEntryList) {
        final String entryName = entry.getName();
        // ignore the parent folder itself and accept only child resources
        final boolean isSupportedEntry = entryName.startsWith(classPath) && !entryName.equals(classPath)
            && accept(entryName, wildcardContext.getWildcard());
        if (isSupportedEntry) {
          allFiles.add(new File(entryName));
          LOG.debug("\tfound jar entry: {}", entryName);
          filteredJarEntryList.add(entry);
        }
      }
      final ByteArrayOutputStream out = new ByteArrayOutputStream();

      triggerWildcardExpander(allFiles, wildcardContext);
      for (final JarEntry entry : filteredJarEntryList) {
        final InputStream is = jarFile.getInputStream(entry);
        IOUtils.copy(is, out);
        is.close();
      }
      return new BufferedInputStream(new ByteArrayInputStream(out.toByteArray()));
    } finally {
      IOUtils.closeQuietly(jarFile);
    }
  }
private InputStream locateStreamFromJar ( final String uri , final File jarPath ) throws IOException { JarFile jarFile = null ; try { LOG . debug ( "Locating stream from jar: {}" , jarPath ) ; final WildcardContext wildcardContext = new WildcardContext ( uri , jarPath ) ; String classPath = FilenameUtils . getPath ( uri ) ; if ( classPath . startsWith ( ClasspathUriLocator . PREFIX ) ) { classPath = substringAfter ( classPath , ClasspathUriLocator . PREFIX ) ; } jarFile = open ( jarPath ) ; final List < JarEntry > jarEntryList = Collections . list ( jarFile . entries ( ) ) ; final List < JarEntry > filteredJarEntryList = new ArrayList < JarEntry > ( ) ; final List < File > allFiles = new ArrayList < File > ( ) ; for ( final JarEntry entry : jarEntryList ) { final String entryName = entry . getName ( ) ; // ignore the parent folder itself and accept only child resources final boolean isSupportedEntry = entryName . startsWith ( classPath ) && ! entryName . equals ( classPath ) && accept ( entryName , wildcardContext . getWildcard ( ) ) ; if ( isSupportedEntry ) { allFiles . add ( new File ( entryName ) ) ; LOG . debug ( "\tfound jar entry: {}" , entryName ) ; filteredJarEntryList . add ( entry ) ; } } final ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; triggerWildcardExpander ( allFiles , wildcardContext ) ; for ( final JarEntry entry : filteredJarEntryList ) { final InputStream is = jarFile . getInputStream ( entry ) ; IOUtils . copy ( is , out ) ; is . close ( ) ; } return new BufferedInputStream ( new ByteArrayInputStream ( out . toByteArray ( ) ) ) ; } finally { IOUtils . closeQuietly ( jarFile ) ; } }
Finds the specified wildcard-URI resource(s) inside a JAR file and returns an {@link InputStream} to read a bundle
of matching resources.

@param uri
Resource(s) URI to match. It cannot be null or empty.
@param jarPath
A valid JAR file. It cannot be null.
@return A valid {@link InputStream} to read the bundle. Clients are responsible of closing this {@link InputStream}
@throws IOException
If there's any error reading the JAR file.
Finds the specified wildcard - URI resource ( s ) inside a JAR file and returns an { @link InputStream } to read a bundle of matching resources .