import java.io.*;
import java.util.zip.*;
public class zipFileDemo02 {
public static void main(String args[]) throws Exception{
File file=new File("d:"+File.separator+"lcda.zip");
File OutputZip=new File("d:"+File.separator+"lcdb");
ZipFile zipFile=new ZipFile(file);
ZipEntry entry=zipFile.getEntry("test.txt");
InputStream input=zipFile.getInputStream(entry);
OutputStream out=new FileOutputStream(OutputZip);
int temp=0;
while((temp=input.read())!=-1){
out.write(temp);
}input.close();
out.close();
} } 这是程序
Exception in thread "main" java.lang.NullPointerException: entry
at java.util.zip.ZipFile.getInputStream(ZipFile.java:340)
at zipFileDemo02.main(zipFileDemo02.java:9) 这是报错。。百度说流没有关闭或者zip有问题。。那怎么解决额。
|
|