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