public static void zipTo(File dir,File destFile){
  FileOutputStream ops=null;
  ZipOutputStream zos=null;
  try {
    ops=new FileOutputStream(destFile);
    zos=new ZipOutputStream(ops);
    zipDir(dir,zos,"");
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
 finally {
    try {
      if (zos != null)       zos.close();
 else       if (ops != null)       ops.close();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
}

public static void zipTo ( File dir , File destFile ) { FileOutputStream ops = null ; ZipOutputStream zos = null ; try { ops = new FileOutputStream ( destFile ) ; zos = new ZipOutputStream ( ops ) ; zipDir ( dir , zos , "" ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } finally { try { if ( zos != null ) zos . close ( ) ; else if ( ops != null ) ops . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } }
zips the given directory " dir " into the zip file " destfile " . if " destfile " already exists , it will be overwritten
