Class ZipBuilder


  • public class ZipBuilder
    extends Object
    Builder for zip content
    • Constructor Detail

      • ZipBuilder

        public ZipBuilder​(String name)
    • Method Detail

      • appendFolder

        public ZipBuilder appendFolder​(String... path)
        Append a folder to the zip content. The path of the folder to be appended is given as an array of folder names.
        Parameters:
        path - the path of the folder
        Returns:
        this
      • appendFile

        public ZipBuilder appendFile​(byte[] content,
                                     String... path)
        Append a file to the zip content. The path of the file to be appended is given as an array of folder names ended with the file name.
        Parameters:
        content - the file content
        path - the path of the file
        Returns:
        this
      • appendFile

        public ZipBuilder appendFile​(FileContent fileContent,
                                     String... path)
        Append a file to the zip content. The path of the file to be appended is given as an array of folder names. The file name will be appended to this path.
        Parameters:
        fileContent - the file content
        path - the folders path
        Returns:
        this
      • toZipBytes

        public byte[] toZipBytes()
                          throws IOException
        Build the zip content based on collected folder and files.
        Returns:
        the zip content as byte array
        Throws:
        IOException - in case of I/O error