Flushes any pending data to the underlying writer. It is useful mainly in compressed network protocols, to ensure that a remote reader has enough data to reconstruct a packet. Flush does not return until the data has been written. Calling flush()
when there is no pending data still causes the Writer to emit a sync marker of at least 4 bytes. If the underlying writer returns an error, flush()
returns that error.
In the terminology of the zlib library, Flush is equivalent to Z_SYNC_FLUSH.