code: public static InputStream
      getInputStreamFromURLOrClasspathOrFileSystem(String textFileOrUrl)
      throws IOException
    {
      InputStream in;
      if (textFileOrUrl.matches("https?://.*")) {
        URL u = new URL(textFileOrUrl);
        URLConnection uc = u.openConnection();
        in = uc.getInputStream();
      } else {
        try {
          in = findStreamInClasspathOrFileSystem(textFileOrUrl);
        } catch (FileNotFoundException e) {
          try {
            // Maybe this happens to be some other format of URL?
            URL u = new URL(textFileOrUrl);
            URLConnection uc = u.openConnection();
            in = uc.getInputStream();
          } catch (IOException e2) {
            // TODO: freaking Java 1.5 didn't have an IOException that
            // could take a throwable as a cause
            throw new IOException("Unable to resolve \"" +
                                  textFileOrUrl + "\" as either " +
                                  "class path, filename or URL");
          }
        }
      }
  
      // buffer this stream
      in = new BufferedInputStream(in);
  
      // gzip it if necessary
      if(textFileOrUrl.endsWith(".gz"))
        in = new GZIPInputStream(in);
  
      return in;
    }
docs: Locates this file either using the given URL, or in the CLASSPATH, or in the file system
  The CLASSPATH takes priority over the file system!
  This stream is buffered and gzipped (if necessary)
  @param textFileOrUrl
  @return An InputStream for loading a resource
  @throws IOException