GZlibCompressor

GZlibCompressor — Zlib compressor

Functions

Properties

GFileInfo * file-info Read / Write
GZlibCompressorFormat format Read / Write / Construct Only
gint level Read / Write / Construct Only

Types and Values

Object Hierarchy

    GObject
    ╰── GZlibCompressor

Implemented Interfaces

GZlibCompressor implements GConverter.

Includes

#include <gio/gio.h>

Description

GZlibCompressor is an implementation of GConverter that compresses data using zlib.

Functions

g_zlib_compressor_new ()

GZlibCompressor *
g_zlib_compressor_new (GZlibCompressorFormat format,
                       int level);

Creates a new GZlibCompressor.

Parameters

format

The format to use for the compressed data

 

level

compression level (0-9), -1 for default

 

Returns

a new GZlibCompressor

Since: 2.24


g_zlib_compressor_get_file_info ()

GFileInfo *
g_zlib_compressor_get_file_info (GZlibCompressor *compressor);

Returns the “file-info” property.

Parameters

compressor

a GZlibCompressor

 

Returns

a GFileInfo, or NULL.

[transfer none]

Since: 2.26


g_zlib_compressor_set_file_info ()

void
g_zlib_compressor_set_file_info (GZlibCompressor *compressor,
                                 GFileInfo *file_info);

Sets file_info in compressor . If non-NULL, and compressor 's “format” property is G_ZLIB_COMPRESSOR_FORMAT_GZIP, it will be used to set the file name and modification time in the GZIP header of the compressed data.

Note: it is an error to call this function while a compression is in progress; it may only be called immediately after creation of compressor , or after resetting it with g_converter_reset().

Parameters

compressor

a GZlibCompressor

 

file_info

a GFileInfo.

[allow-none]

Since: 2.26

Types and Values

GZlibCompressor

typedef struct _GZlibCompressor GZlibCompressor;

Zlib decompression


enum GZlibCompressorFormat

Used to select the type of data format to use for GZlibDecompressor and GZlibCompressor.

Members

G_ZLIB_COMPRESSOR_FORMAT_ZLIB

deflate compression with zlib header

 

G_ZLIB_COMPRESSOR_FORMAT_GZIP

gzip file format

 

G_ZLIB_COMPRESSOR_FORMAT_RAW

deflate compression with no header

 

Since: 2.24

Property Details

The “file-info” property

  “file-info”                GFileInfo *

If set to a non-NULL GFileInfo object, and “format” is G_ZLIB_COMPRESSOR_FORMAT_GZIP, the compressor will write the file name and modification time from the file info to the GZIP header.

Flags: Read / Write

Since: 2.26


The “format” property

  “format”                   GZlibCompressorFormat

The format of the compressed data.

Flags: Read / Write / Construct Only

Default value: G_ZLIB_COMPRESSOR_FORMAT_ZLIB


The “level” property

  “level”                    gint

The level of compression from 0 (no compression) to 9 (most compression), -1 for the default level.

Flags: Read / Write / Construct Only

Allowed values: [-1,9]

Default value: -1