private static void addFileToZip(File srcFile,ZipOutputStream zip){
  byte[] buf=new byte[1024];
  int len;
  FileInputStream in=null;
  try {
    in=new FileInputStream(srcFile);
    while ((len=in.read(buf)) > 0) {
      zip.write(buf,0,len);
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
 finally {
    close(in);
  }
}

private static void addFileToZip ( File srcFile , ZipOutputStream zip ) { byte [ ] buf = new byte [ 1024 ] ; int len ; FileInputStream in = null ; try { in = new FileInputStream ( srcFile ) ; while ( ( len = in . read ( buf ) ) > 0 ) { zip . write ( buf , 0 , len ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } finally { close ( in ) ; } }
add file to zip archive
