public static List < File > extract ( File zipFile , File outputFolder ) throws IOException { List < File > extracted = new ArrayList < File > ( ) ; byte [ ] buffer = new byte [ 2048 ] ; if ( ! outputFolder . exists ( ) ) { outputFolder . mkdir ( ) ; } ZipInputStream zipInput = new ZipInputStream ( new FileInputStream ( zipFile ) ) ; ZipEntry zipEntry = zipInput . getNextEntry ( ) ; while ( zipEntry != null ) { String neFileNameName = zipEntry . getName ( ) ; File newFile = new File ( outputFolder + File . separator + neFileNameName ) ; newFile . getParentFile ( ) . mkdirs ( ) ; if ( ! zipEntry . isDirectory ( ) ) { FileOutputStream fos = new FileOutputStream ( newFile ) ; int size ; while ( ( size = zipInput . read ( buffer ) ) > 0 ) { fos . write ( buffer , 0 , size ) ; } fos . close ( ) ; extracted . add ( newFile ) ; } zipEntry = zipInput . getNextEntry ( ) ; } zipInput . closeEntry ( ) ; zipInput . close ( ) ; return extracted ; }
Extracts the zip file to the output folder