code: public static InputStream getFileOrResource(String name) throws IOException {
          InputStream is = null;
          if (new File(name).isFile()) {
              is = new FileInputStream(name);
          } else {
              is = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
          }
          if (is == null) {
              throw new IOException("Failed to locate " + name);
          }
          return is;
      }
docs: Looks for a file in the file system path named {@code name}, if none
  exist looks for a resource named {@code name} inside the current class
  path.
  
  @param name
  a file or a resource name to find
  @return the corresponding {@code InputStream}
  @throws IOException