public static void compressList(String srcFilePath, String destFilePath) throws Exception {
		File src = new File(srcFilePath);
		if (!src.exists() || !src.isDirectory()) {
			throw new RuntimeException(srcFilePath + "不存在");
		}
		File zipFile = new File(destFilePath);
		ZipOutputStream zos=null;
		try {
			FileOutputStream fos = new FileOutputStream(zipFile);
			CheckedOutputStream cos = new CheckedOutputStream(fos, new CRC32());
			zos = new ZipOutputStream(cos);
			String baseDir = "";
			File[] files = src.listFiles();
			for (File file : files) {
				compressbyType(file, zos, baseDir);
			}			
		} finally {
			if(zos!=null)
			{
				zos.close();
			}
		}
	}
public static void compressList ( String srcFilePath , String destFilePath ) throws Exception { File src = new File ( srcFilePath ) ; if ( ! src . exists ( ) || ! src . isDirectory ( ) ) { throw new RuntimeException ( srcFilePath + "不存在" ) ; } File zipFile = new File ( destFilePath ) ; ZipOutputStream zos = null ; try { FileOutputStream fos = new FileOutputStream ( zipFile ) ; CheckedOutputStream cos = new CheckedOutputStream ( fos , new CRC32 ( ) ) ; zos = new ZipOutputStream ( cos ) ; String baseDir = "" ; File [ ] files = src . listFiles ( ) ; for ( File file : files ) { compressbyType ( file , zos , baseDir ) ; } } finally { if ( zos != null ) { zos . close ( ) ; } } }
压缩目录下的文件列表
@param srcFilePath
@param destFilePath
@throws Exception