服务器上的zip文件没问题,可以正常解压缩。 但输出到客户端就出现问题了。以下是我的错误信息:
 --!   C:\Documents and Settings\liu-wb\桌面\20120406153317.zip: 不可预料的压缩文件末端以下是我输出的方法:
public void sendFileToClient(HttpServletResponse response,
InputStream in, String fileName, String contentType)
throws Exception {
ServletOutputStream out = response.getOutputStream();
response.setContentType(contentType);
response.setHeader("Content-disposition", "attachment;filename="+fileName);
    
     
BufferedInputStream bis = new BufferedInputStream(in);
BufferedOutputStream bos = new BufferedOutputStream(out);
byte[] buff = new byte[2048];
int bytesRead; while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
}
if (bis != null) {
bis.close();
}
if (bos != null) {
bos.close();
}
}请各位高人指点!