Linux Standard Base Core Specification 4.0 | ||
---|---|---|
<<< Previous | Next >>> |
The gzflush() function shall flush pending output to the compressed file stream identified by file, which must be open for writing.
The parameter flush determines which compressed bits
are added to the output file.
If flush is Z_NO_FLUSH
,
gzflush()
may return with some data pending output, and not yet written to the file.
If flush is Z_SYNC_FLUSH
,
gzflush() shall flush all pending output to
file and align the output to a byte
boundary.
There may still be data pending compression that is not flushed.
If flush is Z_FULL_FLUSH
,
all output shall be flushed, as for Z_SYNC_FLUSH
,
and the compression state shall be reset.
There may still be data pending compression that is not flushed.
Rationale:
Z_SYNC_FLUSH
is intended to ensure that the compressed data contains all the data compressed so far, and allows a decompressor to reconstruct all of the input data.Z_FULL_FLUSH
allows decompression to restart from this point if the previous compressed data has been lost or damaged. Flushing is likely to degrade the performance of the compression system, and should only be used where necessary.
If flush is set to Z_FINISH
,
all pending uncompressed data shall be compressed
and all output shall be flushed.
On success, gzflush() shall return the value Z_OK. Otherwise gzflush() shall return a value to indicate the error, and may set the error number associated with the compressed file stream file.
Note: If flush is set to
Z_FINISH
and the flush operation is successful, gzflush() will return Z_OK, but the compressed file stream error value may be set toZ_STREAM_END
.
On error, gzflush() shall return an error value, and may set the error number associated with the stream identified by file to indicate the error. Applications may use gzerror() to access this error value.
<<< Previous | Home | Next >>> |
gzerror | Up | gzgetc |