through the getResourceAsStream should be a lot more efficient than reopening the jar.
499552
private static Reader readerFromUrl(String resourceName) throws IOException {
    URL resourceUrl = TemplateVars.class.getResource(resourceName);
    InputStream in;
    try {
      if (resourceUrl.getProtocol().equalsIgnoreCase("file")) {
        in = inputStreamFromFile(resourceUrl);
      } else if (resourceUrl.getProtocol().equalsIgnoreCase("jar")) {
        in = inputStreamFromJar(resourceUrl);
      } else {
        throw new AssertionError("Template fallback logic fails for: " + resourceUrl);
      }
    } catch (URISyntaxException e) {
      throw new IOException(e);
    }
    return new InputStreamReader(in, StandardCharsets.UTF_8);
  }
557623
@CheckForNull
    private static URL resourceFromFindbugsJar(String slashedResourceName) {
        try {
            @Nullable
            URL findbugsJar = getFindbugsJar();
            if (findbugsJar == null) {
                return null;
            }
            assert findbugsJar.getProtocol().equals("file");
            try (ZipFile jarFile = new ZipFile(new File(findbugsJar.toURI()))) {
                ZipEntry entry = jarFile.getEntry(slashedResourceName);
                if (entry != null) {
                    return resourceFromPlugin(findbugsJar, slashedResourceName);
                }
            } catch (ZipException e) {
                LOG.warn("Failed to load resourceFromFindbugsJar: {} is not valid zip file.", findbugsJar, e);
            } catch (IOException e) {
                LOG.warn("Failed to load resourceFromFindbugsJar: IOException was thrown at zip file {} loading.",
                        findbugsJar, e);
            }
        } catch (MalformedURLException | URISyntaxException e) {
            LOG.warn("Failed to load resourceFromFindbugsJar: Resource name is {}", slashedResourceName, e);
        }
        return null;
    }
569302
@Override
	public URL getResourceUrl(String fileName) {
		if (fileName == null) {
			return null;
		}
		URL resource = getClass().getResource(fileName);
		if (resource == null) {
			resource = Thread.currentThread().getContextClassLoader().getResource(fileName);
			if (resource == null) {
				resource = ClassLoader.getSystemResource(fileName);
				if (resource == null) {
					File file = new File(fileName);
					if (file.exists()) {
						try {
							resource = file.toURI().toURL();
						} catch (MalformedURLException e) {
							throw new JKException(e);
						}
					}
				}
			}
		}
		return resource;
	}
202696
public InputStream getResourceAsStream(String name)
  {
    Source path;

    path = getPath(name);

    if (path != null && path.canRead()) {
      try {
        return path.inputStream();
      } catch (Exception e) {
      }
    }

    return null;
  }
688056
public static InputStream getResourceAsStream(Class<?> clazz, String fn) throws IOException {
		InputStream stream = clazz.getResourceAsStream(fn);
		if (stream == null) {
			throw new IOException("resource \"" + fn + "\" relative to " + clazz + " not found.");
		}
		return unpackStream(stream, fn);
	}
1150512
private static InputStream getStreamFromClassPath(
      final String normalizedPath) {
    InputStream dictInputStream = null;
    final String[] dictPaths = normalizedPath.split("src/main/resources");
    if (dictPaths.length == 2) {
      dictInputStream = IOUtils.class.getClassLoader()
          .getResourceAsStream(dictPaths[1]);
    } else {
      final String[] windowsPaths = normalizedPath
          .split("src\\\\main\\\\resources\\\\");
      if (windowsPaths.length == 2) {
        dictInputStream = IOUtils.class.getClassLoader()
            .getResourceAsStream(windowsPaths[1]);
      }
    }
    return dictInputStream;
  }
869104
protected InputStream getResourceAsStream(String paramString) throws MalformedURLException {
		URL localURL = new URL(paramString);
		try {
			if (null != localURL) {
				URLConnection localURLConnection = localURL.openConnection();
				return localURLConnection.getInputStream();
			}
		} catch (IOException localIOException) {
		}
		return null;
	}
329765
@Override
	public InputStream getResourceAsStream(String resourceName, boolean processingBundle) {

		InputStream is = null;
		if (!resourceName.contains(":") && isAccessPermitted(resourceName)) {
			is = context.getResourceAsStream(resourceName);
		}
		return is;
	}
462567
public static InputStream getResourceAsStream(String fileName) throws FileNotFoundException {
    String localPath = UI_DIR + fileName;
    String altLocalPath = INTERNAL_BUILD_UI_DIR + fileName;
    InputStream in = StaticContentHandler.class.getResourceAsStream(localPath);
    if (in == null) {
      in = StaticContentHandler.class.getResourceAsStream(altLocalPath);
    }
    if (in == null) {
      throw new FileNotFoundException(localPath + " <or> " + altLocalPath);
    }
    return in;
  }
26997
public static File getResourceAsFile(final String resource) {
        final ClassLoader classLoader = FileUtils.class.getClassLoader();
        final String path = classLoader != null
                ? classLoader.getResource(resource).getFile()
                : ClassLoader.getSystemResource(resource).getFile();

        if (path == null) {
            return new File(resource);
        }
        return new File(path);
    }
304233
private static InputStream getResourceAsStream(String path) throws IOException {
    if (StringUtils.isEmpty(path)) {
      return null;
    }

    // first try to load as file
    File file = new File(path);
    if (file.exists() && file.isFile()) {
      return new FileInputStream(file);
    }

    // if not a file fallback to classloader resource
    return CertificateLoader.class.getResourceAsStream(path);
  }
493644
private StreamSource getSource(String pURI)
            throws IOException, MalformedURLException {
        if (pURI != null && pURI.indexOf("://") < 0) {
            // If local, get as stream
            return new StreamSource(getResourceAsStream(pURI));
        }

        // ...else, create from URI string
        return new StreamSource(pURI);
    }
522834
public InputStream getResourceStream(String source) throws ResourceNotFoundException {
		return IoUtil.toStream(source, CharsetUtil.CHARSET_UTF_8);
	}
702711
@Override
	public InputStream getResourceAsStream(String resourceName, boolean processingBundle)
			throws ResourceNotFoundException {

		if (ThreadLocalJawrContext.isInterruptingProcessingBundle()) {
			throw new InterruptBundlingProcessException();
		}

		generatorRegistry.loadGeneratorIfNeeded(resourceName);
		InputStream is = null;

		String resourceExtension = FileNameUtils.getExtension(resourceName);
		boolean generatedPath = generatorRegistry.isPathGenerated(resourceName);
		if (generatedPath || allowedExtensions.contains(resourceExtension.toLowerCase())) {
			List<StreamResourceReader> list = new ArrayList<>();
			list.addAll(streamResourceReaders);
			for (StreamResourceReader rsReader : list) {
				if (!(rsReader instanceof ResourceGenerator)
						|| ((ResourceGenerator) rsReader).getResolver().matchPath(resourceName)) {
					try {
						is = rsReader.getResourceAsStream(resourceName);
					} catch (Exception e) {
						if (LOGGER.isDebugEnabled()) {
							LOGGER.debug("An exception occured while trying to read resource '" + resourceName
									+ "'. Continuing with other readers. Error : ", e);
						} else if (LOGGER.isInfoEnabled()) {
							LOGGER.info("An exception occured while trying to read resource '" + resourceName
									+ "'. Continuing with other readers. Error : " + e.getMessage());
						}
					}
					if (is != null) {
						break;
					}
				}
			}
		} else {
			LOGGER.warn("The resource '" + resourceName + "' will not be read as its extension is not an allowed one.");
		}
		if (is == null) {
			throw new ResourceNotFoundException(resourceName);
		}

		return is;
	}
221971
@SuppressWarnings("resource")
    private InputStream openResource(String name) throws IOException {
        InputStream in;
        if (iFileDir != null) {
            in = new FileInputStream(new File(iFileDir, name));
        } else {
            final String path = iResourcePath.concat(name);
            in = AccessController.doPrivileged(new PrivilegedAction<InputStream>() {
                public InputStream run() {
                    if (iLoader != null) {
                        return iLoader.getResourceAsStream(path);
                    } else {
                        return ClassLoader.getSystemResourceAsStream(path);
                    }
                }
            });
            if (in == null) {
                StringBuilder buf = new StringBuilder(40)
                    .append("Resource not found: \"")
                    .append(path)
                    .append("\" ClassLoader: ")
                    .append(iLoader != null ? iLoader.toString() : "system");
                throw new IOException(buf.toString());
            }
        }
        return in;
    }
558331
public T get(GVRAndroidResource androidResource) {
        WeakReference<T> reference = cache.get(androidResource);
        if (reference == null) {
            // Not in map
            // Log.d(TAG, "get(%s) returning %s", androidResource, null);
            return null;
        }
        T cached = reference.get();
        if (cached == null) {
            // In map, but not in memory
            cache.remove(androidResource);
        } else {
            // No one will ever read this stream
            androidResource.closeStream();
        }
        // Log.d(TAG, "get(%s) returning %s", androidResource, cached);
        return cached;
    }
869796
public final InputStream getResourceAsStream(final String name) {
		try {
			return this.getResource(name).openStream();
		} catch (final Exception ioe) {
			return null;
		}
	}