question: public static void zip ( File inFile , File outFile ) throws IOException { FileInputStream fin = new FileInputStream ( inFile ) ; FileOutputStream fout = new FileOutputStream ( outFile ) ; ZipOutputStream zout = new ZipOutputStream ( fout ) ; try { zout . putNextEntry ( new ZipEntry ( inFile . getName ( ) ) ) ; byte [ ] buffer = new byte [ 1024 ] ; int len ; while ( ( len = fin . read ( buffer ) ) > 0 ) { zout . write ( buffer , 0 , len ) ; } zout . closeEntry ( ) ; } finally { zout . close ( ) ; fin . close ( ) ; } }
target:  Zip contents of inFile to outFile.