我可以压缩文件,但内容错误......例如 - a.txt 中的内容:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚„…†‡‰Š‹ŚŤŽŹ‘’“”•–—™š›śťžź ˇ˘Ł¤Ą¦§¨©Ş«¬®Ż°±˛ł´µ¶·¸ąş»Ľ˝ľżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ`
这是压缩文件的代码:
void zipping() throws FileNotFoundException, IOException {
OutputStream os = new FileOutputStream("C:\\...\\newZip.zip");
ZipOutputStream zos = new ZipOutputStream(os);
File folder = new File("C:\\...\\A");
for (final File fileEntry : folder.listFiles()) {
//ZipEntry ze2 = new ZipEntry(fileEntry.getPath());
//zos.putNextEntry(ze2);
zos.putNextEntry(new ZipEntry(fileEntry.getName()));
for (int i = 0; i < 10000; i++) {
zos.write(i);
}
}
zos.close();
}
错误在哪里?感谢帮助。