From: Debayan Sutradhar Date: Sat, 22 May 2021 21:27:11 +0530 Subject: work --- work --- --- 'a/src/main/java/com/stream_pi/util/iohelper/IOHelper.java' +++ b/src/main/java/com/stream_pi/util/iohelper/IOHelper.java @@ -34,33 +34,33 @@ public class IOHelper byte[] buffer = new byte[1024]; fis = inputStream; - ZipInputStream zis = new ZipInputStream(fis); - ZipEntry ze = zis.getNextEntry(); - while(ze != null) - { - String fileName = ze.getName(); + ZipInputStream zis = new ZipInputStream(fis); + ZipEntry ze = zis.getNextEntry(); + while(ze != null) + { + String fileName = ze.getName(); - File newFile = new File(destDir + File.separator + fileName); + File newFile = new File(destDir + File.separator + fileName); - if(ze.isDirectory()) - { - newFile.mkdirs(); - } - else + if(ze.isDirectory()) + { + newFile.mkdirs(); + } + else + { + FileOutputStream fos = new FileOutputStream(newFile); + int len; + while ((len = zis.read(buffer)) > 0) { - FileOutputStream fos = new FileOutputStream(newFile); - int len; - while ((len = zis.read(buffer)) > 0) - { - fos.write(buffer, 0, len); - } - fos.close(); + fos.write(buffer, 0, len); } - zis.closeEntry(); - ze = zis.getNextEntry(); + fos.close(); } zis.closeEntry(); - zis.close(); - fis.close(); + ze = zis.getNextEntry(); + } + zis.closeEntry(); + zis.close(); + fis.close(); } }