I am working on decompressing Zip archives. As there are two types of archives - Zip and GZip.
I am using following
ZipFile zipFile = new ZipFile(file, ZipFile.OPEN_READ);
But it is giving following error for GZip types of archives
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
This code is working fine for Zip compressed type archives, not for GZip
Is there a way to use the above code as I have existing functionality using ZipFile across various functions.If I change ZipFile interface to ZipInputStream or GZipInputStream, then I need to change multiple things.
EDIT : If incoming archives are of type Zip and GZip, do I need different implementation as per @Joachim Sauer's comment