I am developping an app to decompress an .epub file into SDCARD in Android. I already read the Can't Unzip EPub File TOPIC. IT WORKED FOR .zip files but not for .epub files. Can somone tell me where is the problem ? here is the exception log:
03-21 13:35:44.281: W/System.err(1255): java.io.FileNotFoundException: /mnt/sdcard/unzipped11/META-INF/container.xml: open failed: ENOENT (No such file or directory)
I am using this code:
private void decom() throws IOException {
ZipFile zipFile = new ZipFile(Environment.getExternalStorageDirectory()+"/dir.zip");
String path = Environment.getExternalStorageDirectory() + "/unzipped10/";
Enumeration<?> files = zipFile.entries();
_dirChecker("");
while (files.hasMoreElements()) {
ZipEntry entry = (ZipEntry) files.nextElement();
Log.v("ZipEntry", ""+entry);
Log.v("isDirectory", ""+entry.isDirectory());
if (entry.isDirectory()) {
File file = new File(path + entry.getName());
file.mkdir();
System.out.println("Create dir " + entry.getName());
} else {
File f = new File(path + entry.getName());
FileOutputStream fos = new FileOutputStream(f);
InputStream is = zipFile.getInputStream(entry);
byte[] buffer = new byte[1024];
int bytesRead = 0;
while ((bytesRead = is.read(buffer)) != -1) {
fos.write(buffer, 0, bytesRead);
}
fos.close();
System.out.println("Create File " + entry.getName());
}
}
}