Class PathIteratorZipper

java.lang.Object
nl.knaw.dans.lib.util.PathIteratorZipper

public class PathIteratorZipper extends Object
Zips files from an iterator of paths into a zip file up to a maximum number of files and bytes (the first limit reached). The resulting ZIP file can be compressed or not. The files in the ZIP file can be renamed. The ZIP file can be overwritten if it already exists. Note that directory entries are not included in the ZIP file, as this is not formally required by the ZIP file format.
  • Constructor Details

    • PathIteratorZipper

      public PathIteratorZipper()
  • Method Details

    • zip

      public Path zip() throws IOException
      Zips files from the source iterator into the target zip file.
      Returns:
      the path to the target zip file.
      Throws:
      IOException - if the target zip file already exists and overwrite is false, or if an I/O error occurs while zipping the files.