Class ZipBuilder
java.lang.Object
org.activiti.cloud.services.common.zip.ZipBuilder
Builder for zip content
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappendFile(byte[] content, String... path) Append a file to the zip content.appendFile(FileContent fileContent, String... path) Append a file to the zip content.appendFolder(String... path) Append a folder to the zip content.Build the zip content stream based on collected folder and files.byte[]Build the zip content based on collected folder and files.Build the zip content asFileContentvoidwriteToFile(File file) Write the zip content into the provided file.
-
Constructor Details
-
ZipBuilder
-
-
Method Details
-
appendFolder
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
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
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
-
toByteArrayOutputStream
Build the zip content stream based on collected folder and files.- Returns:
- the zip content as byte array output stream
- Throws:
IOException- in case of I/O error
-
writeToFile
Write the zip content into the provided file.- Parameters:
file- the file where the zip file will be written to- Throws:
IOException- in case of I/O error
-
toZipBytes
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
-
toZipFileContent
Build the zip content asFileContent- Returns:
- the
FileContent - Throws:
IOException- in case of I/O error
-