1、压缩的import java.io.BufferedInputStream;import java.io.BufferedOutputStream;import java.io.File;import java.io.FileInputStream;import java.io.FileOutputStream;import java.util.zip.ZipEntry;import java.util.zip.ZipOutputStream;public class Zip { static
2、 final int BUFFER = 2048; public static void main(String argv[]) { try { BufferedInputStream origin = null; FileOutputStream dest = new FileOutputStream("E:\test\myfiles.zip"); ZipOutputStream out = new ZipO
3、utputStream(new BufferedOutputStream( dest)); byte data[] = new byte[BUFFER]; File f = new File("e:\test\a\"); File files[] = f.listFiles(); for (int i = 0; i < files.length; i++) {
4、 FileInputStream fi = new FileInputStream(files[i]); origin = new BufferedInputStream(fi, BUFFER); ZipEntry entry = new ZipEntry(files[i].getName()); out.putNextEntry(entry); int cou