[求助]java.util.zip 可以这样写吗?
我想把inputfile 压缩成zipfilename ,请问各位高手可以这样写吗?//创建一个ZIP文件zipfilename ----- (xxx.zip)
File f = new File(zipfilename);
FileWriter fw = new FileWriter(f);
ZipOutputStream out = new ZipOutputStream(new BufferedWriter(fw));
//被压缩的文件inputfilename
FileReader in = new FileReader(new File(inputfilename));
BufferedReader br = new BufferedReader(in);
out.putNextEntry(new ZipEntry(inputfilename));
String c;
while ((c = br.readLine())!=null) {
out.write(c);
out.newLine();
}
in.close();
out.close();
----------------解决方案--------------------------------------------------------
请高手详细说明一下为什么ZipOutputStream out = new ZipOutputStream(new BufferedWriter(fw))有问题?
不胜感谢!!!
----------------解决方案--------------------------------------------------------
原来这个论坛也没有高手的!
----------------解决方案--------------------------------------------------------