title: Closing ZipOutputStream
body: <p>I'm a bit confused. I know that an empty zip is not legal. But what about this sample snippet:</p>
  
  <pre><code>ZipOutputStream zos = null; 
  try
  {
      zos = new ZipOutputStream(new FileOutputStream("..."));
      //
      //..
      //
  }
  finally
  {
      zos.close();
  }
  </code></pre>
  
  <p>If no zip entries had been added for some reason (possibly exceptional situation) then the following exception will be thrown on close attempt:</p>
  
  <pre><code>Exception in thread "main" java.util.zip.ZipException: ZIP file must have at least one entry
      at java.util.zip.ZipOutputStream.finish(ZipOutputStream.java:304)
      at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:146)
      at java.util.zip.ZipOutputStream.close(ZipOutputStream.java:321)
  </code></pre>
  
  <p>In this situation what would be the cleanest way to close the stream?</p>
  
  <p>Thanks...</p>