Пример #1
0
 /** Разархивация файла с БД */
 private void dearchiveDB() {
   String zipFile = RES_ABS_PATH + File.separator + DB_ARCHIVE_NAME;
   String outputFolder = RES_ABS_PATH;
   try {
     ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFile));
     ZipEntry ze = zis.getNextEntry();
     while (ze != null) {
       String fileName = ze.getName();
       File newFile = new File(outputFolder + File.separator + fileName);
       System.out.println("File unzip : " + newFile.getAbsoluteFile());
       new File(newFile.getParent()).mkdirs();
       FileOutputStream fos = new FileOutputStream(newFile);
       int len;
       byte[] buffer = new byte[1024];
       while ((len = zis.read(buffer)) > 0) {
         fos.write(buffer, 0, len);
       }
       fos.close();
       ze = zis.getNextEntry();
     }
     zis.closeEntry();
     zis.close();
     System.out.println("File unziped");
   } catch (IOException ex) {
     ex.printStackTrace();
   }
 }