how to create java zip archives with a max file size limit
<p>I need to write an algorithm in java (for an android app) to read a folder containing more folders and each of those containing images and audio files so the structure is this: <code>mainDir/subfolders/myFile1.jpg</code></p>

<ul>
<li><sup>It must be in java, something like perl script is not an option. It would preferably be for the compressed archive in order to squeeze as many files as possible before mailing the zip. Just a normal zip (no jar).</sup></li>
</ul>

<p>My problem is that I need to limit the size of the archive to 16mb and at runtime, create as many archives as needed to contain all my files from my main <code>mainDir</code> folder. I tried several examples from the net, I read the java documentation, but I can't manage to understand and put it all together the way I need it.</p>

<p>Has someone done this before or has a link or an example for me? I resolved the reading of the files with a recursive method but I can't figure the logic for the zip creation.</p>

<p><strong>EDIT:</strong> <a href="http://stackoverflow.com/questions/11084823/filenotfoundexception-no-such-file-or-directory">FileNotFoundException (no such file or directory)</a> this was my initial post at Stack Overflow. I've got an answer to it, but I can't set the size of the ZipEntry and the logic doesn't work and also when extracting the my files from the zip I get the <code>compression method not supported</code> error.</p>
