title: why ZipFile(file, ZipFile.OPEN_READ) does not work for GZip
body: <p>I am working on decompressing Zip archives. As there are two types of archives - Zip and GZip.</p>
  
  <p>I am using following </p>
  
  <pre><code>ZipFile zipFile = new ZipFile(file, ZipFile.OPEN_READ);
  </code></pre>
  
  <p>But it is giving following error for GZip types of archives</p>
  
  <pre><code>java.util.zip.ZipException: error in opening zip file
  at java.util.zip.ZipFile.open(Native Method)
  </code></pre>
  
  <p>This code is working fine for Zip compressed type archives, not for GZip</p>
  
  <p>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.</p>
  
  <p>EDIT : If incoming archives are of type Zip and GZip, do I need different implementation as per @Joachim Sauer's comment</p>