code: public static final void zipFiles(String dirPath,String outFile,FileFilter filter) throws Exception
  	{
  		if(dirPath==null)
  		{
  			throw new IllegalArgumentException("dir ==null");
  		}
  		File dir=new File(dirPath);
  		if(dir.isFile())
  		{
  			throw new IllegalArgumentException("dir "+dir+" is not a dir");
  		}
  		if(!dir.exists())
  		{
  			throw new IllegalArgumentException("dir "+dir+" not found");
  		}
  		ZipOutputStream zos = new ZipOutputStream(new CheckedOutputStream(new FileOutputStream(outFile), new CRC32()));
  		try {
  			String rootDir=dir.getPath();
  			Stack<File> dirs = new Stack<File>();
  			dirs.push(dir);
  			while (!dirs.isEmpty()) 
  			{
  				File path = dirs.pop();
  				File[] fs = path.listFiles(filter);
  				for (File subFile : fs) 
  				{
  					String subPath=subFile.getPath().replace(rootDir+File.separator,"");
  					byte[] data=new byte[] {};
  					if (subFile.isDirectory()) 
  					{//文件夹
  						dirs.push(subFile);
  						subPath+="/";
  					}else
  					{
  						if(subFile.getPath().equals(new File(outFile).getPath()))
  						{
  							continue;
  						}
  						data=Files.readAllBytes(Paths.get(subFile.getPath()));
  					}
  					System.out.println("添加压缩文件:"+subPath);
  					ZipEntry entry = new ZipEntry(subPath);
  					zos.putNextEntry(entry);
  					zos.write(data);
  				}
  			}
  			zos.flush();
  		} finally {
  			zos.close();
  		}
  	}
docs: 压缩目录下的文件列表
  @param dir
  @param filter
  @throws Exception