samedi 23 mai 2015

How can I programmatically extract a file quickly and efficiently within Android? [duplicate]

This question already has an answer here:

I have seen a thread which explains the quickest methods to extract a zip file, but I don't understand how to use it.

Link to Stackoverflow Thread

Code used in thread:

BufferedInputStream in = new BufferedInputStream(zin);
BufferedOutputStream out = new BufferedOutputStream(fout);

And then you can write with something like that:

byte b[] = new byte[1024];
int n;
while ((n = in.read(b,0,1024)) >= 0) {
  out.write(b,0,n);
}

How can I utilize the above, to extract a zip file. And is this the quickest and most efficient method?

Aucun commentaire:

Enregistrer un commentaire