code: public static long zip(File directory, File outputZipFile, boolean fsync) throws IOException
    {
      if (!isZip(outputZipFile.getName())) {
        log.warn("No .zip suffix[%s], putting files from [%s] into it anyway.", outputZipFile, directory);
      }
  
      if (fsync) {
        return FileUtils.writeAtomically(outputZipFile, out -> zip(directory, out));
      } else {
        try (
            final FileChannel fileChannel = FileChannel.open(
                outputZipFile.toPath(),
                StandardOpenOption.WRITE,
                StandardOpenOption.CREATE
            );
            final OutputStream out = Channels.newOutputStream(fileChannel)
        ) {
          return zip(directory, out);
        }
      }
    }
docs: Zip the contents of directory into the file indicated by outputZipFile. Sub directories are skipped
  
  @param directory     The directory whose contents should be added to the zip in the output stream.
  @param outputZipFile The output file to write the zipped data to
  @param fsync         True if the output file should be fsynced to disk
  
  @return The number of bytes (uncompressed) read from the input directory.
  
  @throws IOException