Gio.ZlibCompressor

g GObject.GInterface GObject.GInterface Gio.Converter Gio.Converter GObject.GInterface->Gio.Converter GObject.Object GObject.Object Gio.ZlibCompressor Gio.ZlibCompressor GObject.Object->Gio.ZlibCompressor Gio.Converter->Gio.ZlibCompressor

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gio.Converter (3)

Structs:

GObject.ObjectClass (5)

class

new (format, level)

get_file_info ()

get_os ()

set_file_info (file_info)

set_os (os)

Virtual Methods

Inherited:

GObject.Object (7), Gio.Converter (2)

Properties

Name

Type

Flags

Short Description

file-info

Gio.FileInfo

r/w

format

Gio.ZlibCompressorFormat

r/w/co

level

int

r/w/co

os

int

r/w/en

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Gio.ZlibCompressor(**kwargs)
Bases:

GObject.Object, Gio.Converter

Abstract:

No

Structure:

Gio.ZlibCompressorClass

GZlibCompressor is an implementation of [iface`Gio`.Converter] that compresses data using zlib.

classmethod new(format, level)[source]
Parameters:
  • format (Gio.ZlibCompressorFormat) – the format to use for the compressed data

  • level (int) – compression level (0-9), -1 for default

Returns:

a new [class`Gio`.ZlibCompressor]

Return type:

Gio.ZlibCompressor

Creates a compressor.

New in version 2.24.

get_file_info()[source]
Returns:

file info for the gzip header, if set

Return type:

Gio.FileInfo or None

Gets the [property`Gio`.ZlibCompressor:file-info] property.

New in version 2.26.

get_os()[source]
Returns:

the previously set OS value, or -1 if unset

Return type:

int

Gets the [property`Gio`.ZlibCompressor:os] property.

New in version 2.86.

set_file_info(file_info)[source]
Parameters:

file_info (Gio.FileInfo or None) – file info for the gzip header

Sets the [property`Gio`.ZlibCompressor:file-info] property.

Note: it is an error to call this function while a compression is in progress; it may only be called immediately after creation of self, or after resetting it with [method`Gio`.Converter.reset].

New in version 2.26.

set_os(os)[source]
Parameters:

os (int) – the OS code to use, or -1 to unset

Sets the [property`Gio`.ZlibCompressor:os] property.

Note: it is an error to call this function while a compression is in progress; it may only be called immediately after creation of self, or after resetting it with [method`Gio`.Converter.reset].

New in version 2.86.

Property Details

Gio.ZlibCompressor.props.file_info
Name:

file-info

Type:

Gio.FileInfo

Default Value:

None

Flags:

READABLE, WRITABLE

A [class`Gio`.FileInfo] containing file information to put into the gzip header.

The file name and modification time from the file info will be used.

This will only be used if non-NULL and [property`Gio`.ZlibCompressor:format] is [enum`Gio`.ZlibCompressorFormat.GZIP].

New in version 2.26.

Gio.ZlibCompressor.props.format
Name:

format

Type:

Gio.ZlibCompressorFormat

Default Value:

Gio.ZlibCompressorFormat.ZLIB

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The format of the compressed data.

New in version 2.24.

Gio.ZlibCompressor.props.level
Name:

level

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The level of compression from 0 (no compression) to 9 (most compression).

-1 for the default level.

New in version 2.24.

Gio.ZlibCompressor.props.os
Name:

os

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The OS code of the gzip header.

This will be used if set to a non-negative value, and if [property`Gio`.ZlibCompressor:format] is [enum`Gio`.ZlibCompressorFormat.GZIP], the compressor will set the OS code of the gzip header to this value.

If the value is unset, zlib will set the OS code depending on the platform. This may be undesirable when reproducible output is desired. In that case setting the OS code to 3 (for Unix) is recommended.

New in version 2.86.