1

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.

  • 1
    could you please share source how you use ZipInputStream? – Huds0nHawk Jan 05 '12 at 21:58
  • 1
    I think you're likely to have better results with a download-and-then-decompress process. Disk (or SD card) space is cheap compared to RAM. If the user downloads a large file, it seems like ZipInputStream would need to keep a lot of data in RAM to cross-check the checksums in the index with the actual file data, etc. You can always delete the file after decompression if the user desires. Also, you could use ZipFile, which supports random access, rather than ZipInputStream. – mpontillo Jan 05 '12 at 22:15

0 Answers0