try {
        	FileInputStream fin = new FileInputStream(fileName);
            ZipInputStream zin = new ZipInputStream(fin);

            byte[] buffer = new byte[1024];

            BufferedInputStream in = new BufferedInputStream(zin);
            
            ZipEntry ze = null;
            
            while ((ze = zin.getNextEntry()) != null) {
                
                FileOutputStream fout = new FileOutputStream(mContext.getFilesDir().getAbsolutePath()+"dir/" + ze.getName());
                BufferedOutputStream out = new BufferedOutputStream(fout);
                long c = 0;
                while ((c = in.read(buffer, 0, 1024)) != -1) {
                    out.write(buffer, 0, (int) c);
                }
                zin.closeEntry();
                out.close();
                fout.close();
            }
            
            in.close();
            zin.close();
        } catch (Exception e) {
        }
이렇게 하는겁니당 fileName에 zip의 상세경로를 넣어주고 dir에 원하는 폴더를 지정해주면 dir폴더에 압축파일이 풀리게 된다.
fileName예시 : 다운로드 받아 저장한 path/파일이름.zip




+ Recent posts