I'm currently trying to create a download manager (DLManager) that you can submit links to online files and it keeps track of the progress of all the downloads. I works great for normal files but I wanted to add the ability to download and decompress zip files. I have gotten it to work with two basic steps: Initialization, and then Download. The initializations process sets up a zipInputStream and gathers the file information for the archive using FileEntry.getName and .getSize. Using this information I can calculate the total download size of the queue and any previous progress for resumed downloads. When the DLManager queue's up the link it then starts the download step by setting up another zipInputStream and using the .read method to output the files to disk.
The problem that I am having is that when I initialize the files it take a long time. I can download over three large video files in the time it takes to just initialize one zip file. I'm confused as to how the zipInputStream is working. Is it just streaming the header information first and then waiting for the .read command to download the rest or is it actually downloading the entire archive before returning the header information? If it does download everything at once is there a way to reuse the zipInputStream (return to the first entry)? I tried going as far to read the source for the zipInputStream but got lost. I would be thankful to anyone that can shed some light on this problem. Thanks.