code: public static void readTarGz(Path dirPath, InputStream input) throws IOException {
      InputStream zipStream = new GzipCompressorInputStream(input);
      TarArchiveInputStream archiveStream = new TarArchiveInputStream(zipStream);
      TarArchiveEntry entry;
      while ((entry = (TarArchiveEntry) archiveStream.getNextEntry()) != null) {
        File outputFile = new File(dirPath.toFile(), entry.getName());
        if (entry.isDirectory()) {
          outputFile.mkdirs();
        } else {
          outputFile.getParentFile().mkdirs();
          try (FileOutputStream fileOut = new FileOutputStream(outputFile)) {
            IOUtils.copy(archiveStream, fileOut);
          }
        }
      }
    }
docs: Reads a gzipped tar archive from a stream and writes it to the given path.
  
  @param dirPath the path to write the archive to
  @param input the input stream