为什么非要加上这句不然就报错呢?
ZipOutputStream zipfile = new ZipOutputStream(out);
zipfile.putNextEntry(new ZipEntry(file1.getName()));
int temp;
while((temp=in.read())!=-1)
{
zipfile.write(temp);
}
2 个解决方案
#1
哦。懂了。看了一下Entry的API
#2
Begins writing a new ZIP file entry and positions the stream to the start of the entry data. Closes the current entry if still active. The default compression method will be used if no compression method was specified for the entry, and the current time will be used if the entry has no set modification time.
#1
哦。懂了。看了一下Entry的API
#2
Begins writing a new ZIP file entry and positions the stream to the start of the entry data. Closes the current entry if still active. The default compression method will be used if no compression method was specified for the entry, and the current time will be used if the entry has no set modification time.