一个关于解析ZIP流文件格式的问题
我写了一个解析ZIP文件的CLASS,但是不知道为什么,总是只能解析出一个FILE,然后便抛出“STREAM CLOSED”异常,可是我希望能够解析出所有文件。
有人能帮我下吗
具体代码如下:
private void WorkDone() {
try{
ZipInputStream zip_In=new ZipInputStream(new FileInputStream(selfFile));
ZipEntry entry;
while((entry=zip_In.getNextEntry())!=null){
byte[] buff=new byte[4096];
BufferedInputStream bin=new BufferedInputStream(zip_In);
BufferedOutputStream bout=new BufferedOutputStream(new FileOutputStream(entry.getName()));
System.out.println("File: "+entry.getName()+" has been extracted!");
while(bin.read(buff,0,1)!=-1){
bout.write(buff,0,1);
}
bout.close();
bin.close();
zip_In.closeEntry();
}
zip_In.close();
}catch(IOException exceptionHere){
System.out.println(exceptionHere);
System.exit(0);
}
}