code: public void flush() throws IOException {
          if (syncFlush && !def.finished()) {
              int len = 0;
              while ((len = def.deflate(buf, 0, buf.length, Deflater.SYNC_FLUSH)) > 0)
              {
                  out.write(buf, 0, len);
                  if (len < buf.length)
                      break;
              }
          }
          out.flush();
      }
docs: Flushes the compressed output stream.
  
  If {@link #DeflaterOutputStream(OutputStream, Deflater, int, boolean)
  syncFlush} is {@code true} when this compressed output stream is
  constructed, this method first flushes the underlying {@code compressor}
  with the flush mode {@link Deflater#SYNC_FLUSH} to force
  all pending data to be flushed out to the output stream and then
  flushes the output stream. Otherwise this method only flushes the
  output stream without flushing the {@code compressor}.
  
  @throws IOException if an I/O error has occurred
  
  @since 1.7