Close an IO channel. Any pending data to be written will be flushed, ignoring errors. The channel will not be freed until the last reference is dropped using glib.iochannel.IOChannel.unref.
Flushes the write buffer for the GIOChannel.
This function returns a #GIOCondition depending on whether there is data to be read/space to write data in the internal buffers in the #GIOChannel. Only the flags glib.types.IOCondition.In and glib.types.IOCondition.Out may be set.
Gets the buffer size.
Returns whether channel is buffered.
Returns whether the file/socket/whatever associated with channel will be closed when channel receives its final unref and is destroyed. The default value of this is true for channels created by g_io_channel_new_file (), and false for all other channels.
Gets the encoding for the input/output of the channel. The internal encoding is always UTF-8. The encoding null makes the channel safe for binary data.
Gets the current flags for a #GIOChannel, including read-only flags such as G_IO_FLAG_IS_READABLE.
This returns the string that #GIOChannel uses to determine where in the file a line break occurs. A value of null indicates autodetection.
Initializes a #GIOChannel struct.
Reads data from a #GIOChannel.
Replacement for glib.iochannel.IOChannel.read with the new API.
Reads a line, including the terminating character(s), from a #GIOChannel into a newly-allocated string. str_return will contain allocated memory if the return is G_IO_STATUS_NORMAL.
Reads a line from a #GIOChannel, using a #GString as a buffer.
Reads all the remaining data from the file.
Reads a Unicode character from channel. This function cannot be called on a channel with null encoding.
Sets the current position in the #GIOChannel, similar to the standard library function fseek().
Replacement for glib.iochannel.IOChannel.seek with the new API.
Sets the buffer size.
The buffering state can only be set if the channel's encoding is null. For any other encoding, the channel must be buffered.
Whether to close the channel on the final unref of the #GIOChannel data structure. The default value of this is true for channels created by g_io_channel_new_file (), and false for all other channels.
Sets the encoding for the input/output of the channel. The internal encoding is always UTF-8. The default encoding for the external file is UTF-8.
Sets the (writeable) flags in channel to (flags & G_IO_FLAG_SET_MASK).
This sets the string that #GIOChannel uses to determine where in the file a line break occurs.
Close an IO channel. Any pending data to be written will be flushed if flush is true. The channel will not be freed until the last reference is dropped using glib.iochannel.IOChannel.unref.
Returns the file descriptor of the #GIOChannel.
Writes data to a #GIOChannel.
Replacement for glib.iochannel.IOChannel.write with the new API.
Writes a Unicode character to channel. This function cannot be called on a channel with null encoding.
Converts an errno error number to a #GIOChannelError.
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 glib.iochannel.IOChannel.close (though doing so will not cause problems, as long as no attempt is made to access the channel after it is closed).
Creates a new #GIOChannel given a file descriptor. On UNIX systems this works for plain files, pipes, and sockets.
Pointer to the C boxed value
Get the GType of this boxed type.
Boxed GType property.
Convenience method to return this cast to a type. For use in D with statements.
Make a copy of the wrapped C boxed data.
Copy a C boxed value using g_boxed_copy.
Free a C boxed value using g_boxed_free.
The glib.iochannel.IOChannel data type aims to provide a portable method for using file descriptors, pipes, and sockets, and integrating them into the main event loop (see glib.main_context.MainContext). Currently, full support is available on UNIX platforms; support for Windows is only partially complete.
To create a new glib.iochannel.IOChannel on UNIX systems use glib.iochannel.IOChannel.unixNew. This works for plain file descriptors, pipes and sockets. Alternatively, a channel can be created for a file in a system independent manner using glib.iochannel.IOChannel.newFile.
Once a glib.iochannel.IOChannel has been created, it can be used in a generic manner with the functions glib.iochannel.IOChannel.readChars, glib.iochannel.IOChannel.writeChars, glib.iochannel.IOChannel.seekPosition, and glib.iochannel.IOChannel.shutdown.
To add a glib.iochannel.IOChannel to the main event loop, use func@GLib.io_add_watch or func@GLib.io_add_watch_full. Here you specify which events you are interested in on the glib.iochannel.IOChannel, and provide a function to be called whenever these events occur.
glib.iochannel.IOChannel instances are created with an initial reference count of 1. glib.iochannel.IOChannel.ref_ and glib.iochannel.IOChannel.unref can be used to increment or decrement the reference count respectively. When the reference count falls to 0, the glib.iochannel.IOChannel is freed. (Though it isn’t closed automatically, unless it was created using glib.iochannel.IOChannel.newFile.) Using func@GLib.io_add_watch or func@GLib.io_add_watch_full increments a channel’s reference count.
The new functions glib.iochannel.IOChannel.readChars, glib.iochannel.IOChannel.readLine, glib.iochannel.IOChannel.readLineString, glib.iochannel.IOChannel.readToEnd, glib.iochannel.IOChannel.writeChars, glib.iochannel.IOChannel.seekPosition, and glib.iochannel.IOChannel.flush should not be mixed with the deprecated functions glib.iochannel.IOChannel.read, glib.iochannel.IOChannel.write, and glib.iochannel.IOChannel.seek on the same channel.