【发布时间】:2010-06-30 09:01:10
【问题描述】:
IMO,我认为 epub 是一种 zip 。因此,我尝试在a way 中解压缩。
public class Main {
public static void main(String argv[ ]) {
final int BUFFER = 2048;
try {
BufferedOutputStream dest = null;
FileInputStream fis = new FileInputStream("/Users/yelinaung/Documents/unzip/epub/doyle.epub");
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis));
ZipEntry entry;
while ((entry = zis.getNextEntry()) != null) {
System.out.println("Extracting: " + entry);
int count;
byte data[] = new byte[BUFFER];
// write the files to the disk
FileOutputStream fos = new FileOutputStream("/Users/yelinaung/Documents/unzip/xml/");
dest = new BufferedOutputStream(fos, BUFFER);
while ((count = zis.read(data, 0, BUFFER))
!= -1) {
dest.write(data, 0, count);
}
dest.flush();
dest.close();
}
zis.close();
} catch ( IOException e) {
e.printStackTrace();
}
}
}
我得到了以下错误..
java.io.FileNotFoundException: /Users/yelinaung/Documents/unzip/xml (No such file or directory)
虽然我已经以这种方式创建了一个文件夹......并且
我解压 epub 的方式是否正确? ..纠正我
【问题讨论】: