Package org.craftercms.commons.zip
Class ZipUtils
- java.lang.Object
-
- org.craftercms.commons.zip.ZipUtils
-
public class ZipUtils extends Object
Utility for zipping files.- Author:
- Jose Vega, Alfonso Vásquez
-
-
Constructor Summary
Constructors Constructor Description ZipUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
unZipFiles(File zipFile, File outputFolder)
Unzips a zip file into an output folder.static void
unZipFiles(InputStream inputStream, File outputFolder)
Unzips a zip from an input stream into an output folder.static void
zipFiles(List<File> files, File zipFile)
Zips a collection of files to a destination zip file.static void
zipFiles(List<File> files, OutputStream outputStream)
Zips a collection of files to a destination zip output stream.
-
-
-
Method Detail
-
zipFiles
public static void zipFiles(List<File> files, OutputStream outputStream) throws IOException
Zips a collection of files to a destination zip output stream.- Parameters:
files
- A collection of files and directoriesoutputStream
- The output stream of the destination zip file- Throws:
FileNotFoundException
IOException
-
zipFiles
public static void zipFiles(List<File> files, File zipFile) throws IOException
Zips a collection of files to a destination zip file.- Parameters:
files
- A collection of files and directorieszipFile
- The path of the destination zip file- Throws:
FileNotFoundException
IOException
-
unZipFiles
public static void unZipFiles(InputStream inputStream, File outputFolder) throws IOException
Unzips a zip from an input stream into an output folder.- Parameters:
inputStream
- the zip input streamoutputFolder
- the output folder where the files- Throws:
IOException
-
unZipFiles
public static void unZipFiles(File zipFile, File outputFolder) throws IOException
Unzips a zip file into an output folder.- Parameters:
zipFile
- the zip fileoutputFolder
- the output folder where the files- Throws:
IOException
-
-