In Android I want to pack some files into Zip archive (using java.util.zip). But I have a limit for output file size – so is there a possibility to pack them into multiple, fixed-size files?
In Android I want to pack some files into Zip archive (using java.util.zip ).
Share
What if you do it like this:
Let’s say, that you know (aproximately) the compress ratio of your files… You take first few files that doesn’t exceed for example 2MB. If compress ratio is 50% you’ll get 1MB file at the end. You repeat the process untill you zip all the files…
Regarding one big text file I would suggest this. Read the file and write it into two/three/four seperate files. You can do this with
FileInputStreamandFileOutputStream… ZIP each of parts.. After unziping, glue them together again with help ofFile(Input/Output)Stream.