Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. public static void unzip(File zipFile, File targetDirectory) throws IOException {
  2. ZipInputStream zis = new ZipInputStream(
  3. new BufferedInputStream(new FileInputStream(zipFile)));
  4. try {
  5. ZipEntry ze;
  6. int count;
  7. byte[] buffer = new byte[8192];
  8. while ((ze = zis.getNextEntry()) != null) {
  9. File file = new File(targetDirectory, ze.getName());
  10. File dir = ze.isDirectory() ? file : file.getParentFile();
  11. } finally {
  12. zis.close();
  13. }
  14. }
  15.  
  16. File file = new File(context.getFilesDir() + "/ACPLUS.ZIP");
  17. File targetDir = new File(context.getFilesDir() + "/DATA");
  18.  
  19. if (!targetDir.exists()) {
  20. targetDir.mkdirs();
  21. }
  22.  
  23. if(file.exists()) {
  24. try {
  25. ZIPHandler.unzip(file, targetDir);
  26. }
  27. catch (IOException e) {
  28. e.printStackTrace();
  29. }
  30. }
  31.  
  32. while ((ze = zis.getNextEntry()) != null) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement