code: public String extractFileFromArchive(File downloadedCompressedFile, String extractedToFilePath, BinaryType possibleFilenames) throws IOException, IllegalArgumentException, MojoFailureException {
          DownloadableFileType fileType = DownloadableFileType.valueOf(FilenameUtils.getExtension(downloadedCompressedFile.getName()).toUpperCase());
          LOG.debug("Determined archive type: " + fileType);
          LOG.debug("Overwrite files that exist: " + overwriteFilesThatExist);
  
          switch (fileType) {
              case GZ:
              case BZ2:
                  CompressedFile compressedFile = new CompressedFile(downloadedCompressedFile);
                  if (null != compressedFile.getArchiveType() && compressedFile.getArchiveType().equals(TAR)) {
                      return untarFile(compressedFile.getInputStream(), extractedToFilePath, possibleFilenames);
                  } else {
                      return copyFileToDisk(compressedFile.getInputStream(), extractedToFilePath, compressedFile.getDecompressedFilename());
                  }
              case ZIP:
                  return unzipFile(downloadedCompressedFile, extractedToFilePath, possibleFilenames);
              case EXE:
                  if (possibleFilenames.getBinaryFilenames().contains(downloadedCompressedFile.getName())) {
                      return copyFileToDisk(new FileInputStream(downloadedCompressedFile), extractedToFilePath, downloadedCompressedFile.getName());
                  }
              default:
                  throw new IllegalArgumentException("." + fileType + " is an unsupported archive type");
          }
      }
docs: Extract binary from a downloaded archive file
  
  @param downloadedCompressedFile The downloaded compressed file
  @param extractedToFilePath      Path to extracted file
  @param possibleFilenames        Names of the files we want to extract
  @return boolean
  @throws IOException              Unable to write to filesystem
  @throws IllegalArgumentException Unsupported archive
  @throws MojoFailureException     Error running plugin