【发布时间】:2011-05-12 12:02:25
【问题描述】:
我正在使用以下代码解压缩文件。
我遇到了这个异常“unZip()=java.io.IOException”,但文件已解压缩并创建!
有什么想法吗?
谢谢。
public boolean unZipPage(int page)
{
try
{
File f=new File(zippagename);
FileOutputStream out = new FileOutputStream(f);
ZipEntry fh=fhs.get(page);
InputStream is = zif.getInputStream(fh);
byte buf[] = new byte[1024];
int numread;
while((numread = is.read(buf,0,1024))>=0)
{
out.write(buf, 0, numread);
}
is.close();
out.flush();
out.close();
}
return true;
}
catch (FileNotFoundException e)
{
Log.v("comicsZip", "unZip()=" + e);
}
catch (IOException e)
{
Log.v("comicsZip", "unZip()=" + e + " Page="+page);
}
return false;
}
【问题讨论】:
-
执行 e.printStackTrace() 和/或 e.getMessage() 看看它说了什么;较长的消息可能会解释问题。
-
检查异常发生的位置............