final int BUFFER_SIZE = 4096;
BufferedOutputStream bufferedOutputStream = null;
FileInputStream fileInputStream;
try
{
fileInputStream = new FileInputStream(src);
ZipInputStream zipInputStream = new ZipInputStream(new BufferedInputStream(fileInputStream));
ZipEntry zipEntry;
while ((zipEntry = zipInputStream.getNextEntry()) != null)
{
String zipEntryName = zipEntry.getName();
File file = new File(dest + File.separator + zipEntryName);
if (file.exists())
{
}
else
{
if (zipEntry.isDirectory())
{
file.mkdirs();
}
else
{
byte buffer[] = new byte[BUFFER_SIZE];
FileOutputStream fileOutputStream = new FileOutputStream(file);
bufferedOutputStream = new BufferedOutputStream(fileOutputStream, BUFFER_SIZE);
int count;
while ((count = zipInputStream.read(buffer, 0, BUFFER_SIZE)) != -1)
{
bufferedOutputStream.write(buffer, 0, count);
}
bufferedOutputStream.flush();
bufferedOutputStream.close();
}
}
}
zipInputStream.close();
File s = new File(src);
s.delete();
} catch (FileNotFoundException e)
{
e.printStackTrace();
} catch (IOException e)
{
e.printStackTrace();
'Mobile > Android' 카테고리의 다른 글
[Android] 다이얼로그를 이용 유저가 동의하면 액티비티가 종료 (0) | 2019.01.11 |
---|---|
[Android] 맥북에서 android Home 설정 (0) | 2019.01.04 |
ICS(Android 4.0) 에뮬 돌리기 (0) | 2011.11.16 |
[Android] TaskManager (0) | 2011.11.11 |
[Android] 외부 폰트 사용 (0) | 2011.11.10 |