|
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
|
'Android > File' 카테고리의 다른 글
프로젝트에 포함된 이미지를 SdCard로 이동시키기. (0) | 2011.06.12 |
---|---|
단말기 내부에 폴더 및 txt파일 생성하기 (0) | 2011.03.02 |
Sd Card 이미지 읽어오기 (0) | 2011.02.14 |
txt 파일 읽어오기 (0) | 2011.02.11 |
SD Card에 txt 파일로 저장하기 (0) | 2011.02.05 |