GskZlibDeflator

GskZlibDeflator — a zlib compressor.

Synopsis

                    GskZlibDeflator;
GskStream *         gsk_zlib_deflator_new               (gint compression_level,
                                                         int flush_millis);

Description

A stream which compresses data on its input to its output. This is the raw zlib deflated data. See RFCs 1950 and 1951.

We use the implementation in a shared library -lz.

Details

GskZlibDeflator

typedef struct {
  GskStream      stream;
  gpointer       private_stream;
  GskBuffer      compressed;
  guint          level;
  gint           flush_millis;
  GskSource     *flush_source;
  gboolean       use_gzip;
} GskZlibDeflator;

A zlib deflator (compressor) object. One writes raw data to it, and one can read the compressed data from it.

GskStream stream;

parent instance.

gpointer private_stream;

zlib library object.

GskBuffer compressed;

buffer of compressed data.

guint level;

compressor level (private).

gint flush_millis;

milliseconds to wait to flush the buffer or -1 to indicate that flush need only be done at end-of-file.

GskSource *flush_source;

private: flush timeout source.

gboolean use_gzip;


gsk_zlib_deflator_new ()

GskStream *         gsk_zlib_deflator_new               (gint compression_level,
                                                         int flush_millis);

Create a new Zlib deflation stream. This stream is written uncompressed input, and then compressed output can be read back from it.

compression_level :

the level of compression to attain in exchange for running slower.

flush_millis :

number of milliseconds to wait before flushing all input characters to the output. Use -1 to not set timeouts, which means the buffers are only flushed after a write-shutdown.

Returns :

the newly allocated deflator.

See Also

GskZlibInflator