title: zip headers not found. probably not a zip file
body: <p>I develop one utility to add image to existing zip file.In  most of case I get positve resulte. but in same case utility throw error of </p>
  
  <blockquote>
    <p>zip headers not found. probably not a zip file</p>
  </blockquote>
  
  <p>but file is open in "archive manager" or winrar. my code is as following: </p>
  
  <pre><code>public static boolean addFileIntoZip(String sourceFile, String zipFile) {
          try {
              logger.debug("add file in Zip&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;");
              logger.debug("Source Folder {} and Destination Folder {}", sourceFile, zipFile);
              ZipFile file = new ZipFile(zipFile);
              File sFile = new File(sourceFile);
              // Initiate Zip Parameters which define various properties such
              // as compression method, etc.
              ZipParameters parameters = new ZipParameters();
  
              // set compression method to store compression
              parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
  
              // Set the compression level
              parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
  
              file.addFile(sFile, parameters);
  
              return true;
          } catch (ZipException e) {
              e.printStackTrace();
          }
          return false;
      }
  </code></pre>
  
  <p>error stack is </p>
  
  <pre><code>2016-11-03 15:55:39 [DEBUG] (ZipUtil.java:121) =&gt; add file in Zip&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;
  2016-11-03 15:55:39 [DEBUG] (ZipUtil.java:122) =&gt; Source Folder /home/sanjeet/Downloads/DocumentViewer_architecture.png and Destination Folder /home/sanjeet/Downloads/tst/000033541066253_D.zip
  net.lingala.zip4j.exception.ZipException: zip headers not found. probably not a zip file
      at net.lingala.zip4j.core.HeaderReader.readEndOfCentralDirectoryRecord(HeaderReader.java:122)
      at net.lingala.zip4j.core.HeaderReader.readAllHeaders(HeaderReader.java:78)
      at net.lingala.zip4j.core.ZipFile.readZipInfo(ZipFile.java:425)
      at net.lingala.zip4j.core.ZipFile.checkZipModel(ZipFile.java:935)
      at net.lingala.zip4j.core.ZipFile.addFiles(ZipFile.java:263)
      at net.lingala.zip4j.core.ZipFile.addFile(ZipFile.java:250)
      at com.grit.docs.util.ZipUtil.addFileIntoZip(ZipUtil.java:135)
      at com.grit.docs.util.ZipUtil.main(ZipUtil.java:160)
  </code></pre>
  
  <p>file also not unzip by unzip tool in ubuntu. it show error as </p>
  
  <pre><code>Archive:  000033541066253_D.zip
    End-of-central-directory signature not found.  Either this file is not
    a zipfile, or it constitutes one disk of a multi-part archive.  In the
    latter case the central directory and zipfile comment will be found on
    the last disk(s) of this archive.
  unzip:  cannot find zipfile directory in one of 000033541066253_D.zip or
          000033541066253_D.zip.zip, and cannot find 000033541066253_D.zip.ZIP, period.
  </code></pre>
  
  <p>I use zip4j zip lib. </p>
  
  <p>Kindly help to fix this problem. </p>