I have a zip file in my res/raw
directory. I want to open the zip file and iterate through the text files that are stored in it. I do not want to extract and write the files to the device; I just want to open the zip file, iterate through the lines in each text file, and then close the zip file.
I'm having trouble trying to read in the zip file because the openRawResource
method returns an InputStream
. I tried to convert the stream to a ZipInputStream
, but I'm lost as to what to do next.
How do I create a ZipFile
object in this case?
It's not much, but here's what I have so far:
InputStream in = getResources().openRawResource(R.raw.primes);
ZipInputStream zin = new ZipInputStream(in);
ZipEntry entry;
while ((entry = zin.getNextEntry()) != null) {
// TODO
}