code: public static InputStream getStream (String path, ClassLoader loader)
      {
          // first try the supplied class loader
          InputStream in = getResourceAsStream(path, loader);
          if (in != null) {
              return in;
          }
  
          // if that didn't work, try the system class loader (but only if it's different from the
          // class loader we just tried)
          try {
              ClassLoader sysloader = ClassLoader.getSystemClassLoader();
              if (sysloader != loader) {
                  return getResourceAsStream(path, loader);
              }
          } catch (AccessControlException ace) {
              // can't get the system loader, no problem!
          }
          return null;
      }
docs: Returns an input stream referencing a file that exists somewhere in the classpath.
  
  <p> The supplied classloader is searched first, followed by the system classloader.
  
  @param path The path to the file, relative to the root of the classpath directory from which
  it will be loaded (e.g. <code>com/foo/bar/foo.gif</code>).