科帕奇越野视频大全:我的压缩文件怎么比没压缩之前的文件还大??

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/09 20:03:06
try {
FileInputStream fis = new FileInputStream(fi);
File fo = new File("1.zip");
FileOutputStream fos= new FileOutputStream(fo);
ZipOutputStream zos = new ZipOutputStream(fos);
zos.setMethod(ZipOutputStream.DEFLATED); // 设置压缩方法
zos.setLevel(9);
ZipEntry ze= new ZipEntry(fi.getName());
zos.putNextEntry(ze);
int temp = fis.read();
while (temp != -1) {
zos.write(temp);
temp = fis.read();
}
zos.write(-1);
zos.closeEntry();
zos.finish();
zos.close();
fis.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return true;

技术问题!