code: public static InputStream newInputStream(Path path, OpenOption... options) throws IOException {
          FileUtils.checkFile(path);
          InputStream inputStream = Files.newInputStream(path, options);
          if (path.toFile().getName().endsWith(".gz")) {
              inputStream = new GZIPInputStream(inputStream);
          }
          return inputStream;
      }
docs: This method is able to determine whether a file is GZipped and return an {@link InputStream} in any case.
  
  @param path     the path to the file to open
  @param options   options specifying how the file is opened
  @return          a new input stream
  @throws IOException  if an I/O error occurs