Class ZipBuilder
- java.lang.Object
-
- org.activiti.cloud.services.common.zip.ZipBuilder
-
public class ZipBuilder extends java.lang.ObjectBuilder for zip content
-
-
Constructor Summary
Constructors Constructor Description ZipBuilder(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ZipBuilderappendFile(byte[] content, java.lang.String... path)Append a file to the zip content.ZipBuilderappendFile(FileContent fileContent, java.lang.String... path)Append a file to the zip content.ZipBuilderappendFolder(java.lang.String... path)Append a folder to the zip content.byte[]toZipBytes()Build the zip content based on collected folder and files.FileContenttoZipFileContent()Build the zip content asFileContent
-
-
-
Method Detail
-
appendFolder
public ZipBuilder appendFolder(java.lang.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, java.lang.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 contentpath- the path of the file- Returns:
- this
-
appendFile
public ZipBuilder appendFile(FileContent fileContent, java.lang.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 contentpath- the folders path- Returns:
- this
-
toZipBytes
public byte[] toZipBytes() throws java.io.IOExceptionBuild the zip content based on collected folder and files.- Returns:
- the zip content as byte array
- Throws:
java.io.IOException- in case of I/O error
-
toZipFileContent
public FileContent toZipFileContent() throws java.io.IOException
Build the zip content asFileContent- Returns:
- the
FileContent - Throws:
java.io.IOException- in case of I/O error
-
-