public static void zipFiles ( List < File > files , OutputStream outputStream ) throws IOException { ZipOutputStream zos = new ZipOutputStream ( outputStream ) ; for ( File file : files ) { if ( file . isDirectory ( ) ) { //if it's a folder addFolderToZip ( "" , file , zos ) ; } else { addFileToZip ( "" , file , zos ) ; } } zos . finish ( ) ; }
Zips a collection of files to a destination zip output stream .