code: private String untarFile(InputStream compressedFileInputStream, String extractedToFilePath, BinaryType possibleFilenames) throws IOException, ExpectedFileNotFoundException {
          LOG.debug("Attempting to extract binary from a .tar file...");
          ArchiveEntry currentFile;
          ArrayList<String> filenamesWeAreSearchingFor = new ArrayList<String>(possibleFilenames.getBinaryFilenames());
          try {
              if (filenamesWeAreSearchingFor.contains("*")) {
                  filenamesWeAreSearchingFor.remove(0);
                  LOG.debug("Extracting full archive");
                  return this.untarFolder(compressedFileInputStream, extractedToFilePath, filenamesWeAreSearchingFor);
              } else {
                  ArchiveInputStream archiveInputStream = new TarArchiveInputStream(compressedFileInputStream);
                  while ((currentFile = archiveInputStream.getNextEntry()) != null) {
                      for (String aFilenameWeAreSearchingFor : filenamesWeAreSearchingFor) {
                          if (currentFile.getName().endsWith(aFilenameWeAreSearchingFor)) {
                              LOG.debug("Found: " + currentFile.getName());
                              return copyFileToDisk(archiveInputStream, extractedToFilePath, aFilenameWeAreSearchingFor);
                          }
                      }
                  }
              }
          } finally {
              compressedFileInputStream.close();
          }
  
          throw new ExpectedFileNotFoundException(
                  "Unable to find any expected filed for " + possibleFilenames.getBinaryTypeAsString());
      }
docs: Untar a decompressed tar file (this will implicitly overwrite any existing files)
  
  @param compressedFileInputStream The expanded tar file
  @param extractedToFilePath       Path to extracted file
  @param possibleFilenames         Names of the files we want to extract
  @return boolean
  @throws IOException MojoFailureException