code: public static boolean execute(
      final File source, final File destination, final boolean deleteSource)
            throws IOException {
      if (source.exists()) {
        FileInputStream fis = new FileInputStream(source);
        FileOutputStream fos = new FileOutputStream(destination);
        GZIPOutputStream gzos = new GZIPOutputStream(fos);
        byte[] inbuf = new byte[8102];
        int n;
  
        while ((n = fis.read(inbuf)) != -1) {
          gzos.write(inbuf, 0, n);
        }
  
        gzos.close();
        fis.close();
  
        if (deleteSource && !source.delete()) {
            LogLog.warn("Unable to delete " + source.toString() + ".");
        }
  
        return true;
      }
  
      return false;
    }
docs: Compress a file.
  
  @param source file to compress, may not be null.
  @param destination compressed file, may not be null.
  @param deleteSource if true, attempt to delete file on completion.  Failure to delete
  does not cause an exception to be thrown or affect return value.
  @return true if source file compressed.
  @throws IOException on IO exception.