code: public static InputStream getStream(final String name)
              throws FileNotFoundException {
          if (name == null) {
              throw new IllegalArgumentException("'name' must not be null");
          }
          final File file = new File(name);
          if (file.exists()) {
              return getStream(file);
          }
  
          InputStream stream = Thread.currentThread().getContextClassLoader()
                  .getResourceAsStream(name);
          if (stream != null) {
              return stream;
          }
  
          try {
              stream = new URL(name).openStream();
          } catch (final IOException e) {
              throwFileNotFoundException(name, e);
          }
          if (stream == null) {
              throwFileNotFoundException(name, null);
          }
  
          return stream;
  
      }
docs: First attempts to open open {@code name} as a file. On fail attempts to
  open resource with name {@code name}. On fail attempts to open {@code name}
  as a URL.
  
  @param name name of the file or resource to open
  @return an input stream for reading the opened file or resource
  @throws FileNotFoundException if all attempts fail