IoChannel

constructor(filename: String, mode: String)(source)

Open a file @filename as a #GIOChannel using mode @mode. This channel will be closed when the last reference to it is dropped, so there is no need to call g_io_channel_close() (though doing so will not cause problems, as long as no attempt is made to access the channel after it is closed).

Return

A #GIOChannel on success, null on failure.

Parameters

filename

A string containing the name of a file

mode

One of "r", "w", "a", "r+", "w+", "a+". These have the same meaning as in fopen()


constructor(fd: <Error class: unknown class>)(source)

Creates a new #GIOChannel given a file descriptor. On UNIX systems this works for plain files, pipes, and sockets.

The returned #GIOChannel has a reference count of 1.

The default encoding for #GIOChannel is UTF-8. If your application is reading output from a command using via pipe, you may need to set the encoding to the encoding of the current locale (see g_get_charset()) with the g_io_channel_set_encoding() function. By default, the fd passed will not be closed when the final reference to the #GIOChannel data structure is dropped.

If you want to read raw binary data without interpretation, then call the g_io_channel_set_encoding() function with null for the encoding argument.

This function is available in GLib on Windows, too, but you should avoid using it on Windows. The domain of file descriptors and sockets overlap. There is no way for GLib to know which one you mean in case the argument you pass to this function happens to be both a valid file descriptor and socket. If that happens a warning is issued, and GLib assumes that it is the file descriptor you mean.

Return

a new #GIOChannel.

Parameters

fd

a file descriptor.


constructor()(source)

Allocate a new IoChannel.

This instance will be allocated on the native heap and automatically freed when this class instance is garbage collected.


constructor(scope: <Error class: unknown class>)(source)

Allocate a new IoChannel using the provided AutofreeScope.

The AutofreeScope manages the allocation lifetime. The most common usage is with memScoped.

Parameters

scope

The AutofreeScope to allocate this structure in.


constructor(glibIoChannelPointer: <Error class: unknown class><<Error class: unknown class>>)(source)