Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean mUnpackZipFile(String mArchivePath,String mOutPutStream) {
- InputStream inputstream;
- ZipInputStream zipinputstream;
- Message msg;
- try {
- String filename;
- inputstream = new FileInputStream(mArchivePath);
- zipinputstream = new ZipInputStream(new BufferedInputStream(inputstream));
- ZipEntry mZipEntry;
- byte[] buffer = new byte[1024];
- int count;
- while ((mZipEntry = zipinputstream.getNextEntry()) != null) {
- filename = mZipEntry.getName();
- if (mZipEntry.isDirectory()) {
- File fmd = new File(mOutPutStream + filename);
- fmd.mkdirs();
- continue;
- }
- FileOutputStream fileoutputstream = new FileOutputStream(mOutPutStream + filename);
- msg = h.obtainMessage(FILE_NAME, filename);
- h.sendMessage(msg);
- while ((count = zipinputstream.read(buffer)) != -1) {
- fileoutputstream.write(buffer, 0, count);
- }
- fileoutputstream.close();
- zipinputstream.closeEntry();
- }
- zipinputstream.close();
- } catch (IOException e) {
- e.printStackTrace();
- return false;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement