### Interface

# Gio Converter

since: 2.24

#### Description

    interface Gio.Converter : GObject.Object

`GConverter` is an interface for streaming conversions.

`GConverter` is implemented by objects that convert binary data in various ways. The conversion can be stateful and may fail at any place.

Some example conversions are: character set conversion, compression, decompression and regular expression replace.

Available since: 2.24

#### Prerequisite

In order to implement Converter, your type must inherit from`GObject`.

#### Implementations

- GCharsetConverter
- GZlibCompressor
- GZlibDecompressor

#### Instance methods

###### g_converter_convert

This is the main operation used when converting data. It is to be called multiple times in a loop, and each time it will do some work, i.e. producing some output (in `outbuf`) or consuming some input (from `inbuf`) or both. If its not possible to do any work an error is returned.

since: 2.24

###### g_converter_reset

Resets all internal state in the converter, making it behave as if it was just created. If the converter has any internal state that would produce output then that output is lost.

since: 2.24

#### Interface structure

    struct GioConverterIface {
      GTypeInterface g_iface;
      GConverterResult (* convert) (
        GConverter* converter,
        void* inbuf,
        gsize inbuf_size,
        void* outbuf,
        gsize outbuf_size,
        GConverterFlags flags,
        gsize* bytes_read,
        gsize* bytes_written,
        GError** error
      );
      void (* reset) (
        GConverter* converter
      );

    }

Provides an interface for converting data from one type to another type. The conversion can be stateful and may fail at any place.

###### Interface members

`g_iface` |
    GTypeInterface
| The parent interface.
`convert` |
    GConverterResult (* convert) (
        GConverter* converter,
        void* inbuf,
        gsize inbuf_size,
        void* outbuf,
        gsize outbuf_size,
        GConverterFlags flags,
        gsize* bytes_read,
        gsize* bytes_written,
        GError** error
      )
| No description available.
`reset` |
    void (* reset) (
        GConverter* converter
      )
| No description available.

#### Virtual methods

###### Gio.Converter.convert

This is the main operation used when converting data. It is to be called multiple times in a loop, and each time it will do some work, i.e. producing some output (in `outbuf`) or consuming some input (from `inbuf`) or both. If its not possible to do any work an error is returned.

since: 2.24

###### Gio.Converter.reset

Resets all internal state in the converter, making it behave as if it was just created. If the converter has any internal state that would produce output then that output is lost.

since: 2.24