glib-sharp System.Object GLib.IWrapper System.IDisposable IO Channel class. Provides methods to read and write data to an IO channel.
- Constructor
  A UNIX file descriptor.
  Public constructor.
  Constructs a channel for a UNIX file descriptor or pipe.
- Constructor
  Path to a file.
  One of "r", "w", "a", "r+", "w+", "a+", with the same meaning as fopen.
  Public constructor.
  Constructs a channel for a file with a given mode.
- Method
  System.UInt32 `` `` `` Priority level. Default priority is 0. System defined values range from -100 (High priority) to 300 (Low priority). Conditions to notify. Notification callback delegate. Adds a notification watch to the mainloop at a given priority. A source ID which can be removed with .

  The following example spawns a process to run the pwd command and writes the output to the console using an IOChannel watch:

  `using GLib; using System; public class SpawnTest { public static void Main (string[] args) { new SpawnTest (); } MainLoop main_loop; IOChannel channel; public SpawnTest () { main_loop = new MainLoop (); try { Process proc; int stdin = Process.IgnorePipe; int stdout = Process.RequestPipe; int stderr = Process.IgnorePipe; GLib.Process.SpawnAsyncWithPipes (null, new string[] {"pwd"}, null, SpawnFlags.SearchPath, null, out proc, ref stdin, ref stdout, ref stderr); channel = new IOChannel (stdout); channel.AddWatch (0, IOCondition.In | IOCondition.Hup, new IOFunc (ReadStdout)); } catch (Exception e) { Console.WriteLine ("Exception in Spawn: " + e); } main_loop.Run (); } bool ReadStdout (IOChannel source, IOCondition condition) { if ((condition & IOCondition.In) == IOCondition.In) { string txt; if (source.ReadToEnd (out txt) == IOStatus.Normal) Console.WriteLine ("[SpawnTest output] " + txt); } if ((condition & IOCondition.Hup) == IOCondition.Hup) { source.Dispose (); main_loop.Quit (); return true; } return true; } }`

- Property
  GLib.IOCondition BufferCondition property. Indicates if there is data to read or room to output to the channel.
- Property
  System.Boolean Buffered property. A boolean value indicating if buffering is active. Buffering can only be altered when the is . All other encodings must be buffered. It can only be cleared after the buffer has been flushed.
- Property
  System.UInt64 BufferSize property. The buffer size, or 0 to pick a reasonable size.
- Property
  System.Boolean CloseOnUnref property. A boolean indicating if the channel should be closed on disposal.
- Method
  System.Void Disposes the channel.
- Property
  System.String Encoding property. Specifies the native encoding of the channel. Use for binary channels. The default encoding is UTF8.
- Method
  GLib.IOChannelError `` Error number. Converts an error number to an Error value. The error.
- Property
  GLib.IOFlags Flags property. The IO Flags for the channel.
- Method
  GLib.IOStatus Flushes the write buffer for the channel. Status of the operation.
- Method
  GLib.IOChannel `` Native channel pointer. Wraps a native channel. A managed channel instance. Provided for language binding use.
- Property
  System.IntPtr Handle property. A point to the native channel. Provided for language binding use.
- Method
  System.Void Init method. Provided for subclassers to initialize derived channels.
- Property
  System.Char[] LineTerminator property. The chars representing line termination in the channel. This property is represented as an array of chars to allow for null char terminators.
- Method
  GLib.IOStatus `` `` Buffer to store the read data. Length of data read. Reads data from the channel. An operation status value. Method fills the buffer with as many complete utf8 characters as possible. Provided primarily for binary data reading in null encodings. Use for text stream reading to strings.
- Method
  GLib.IOStatus `` Returns the next line in the channel. Reads a line from the channel. An operation status value.
- Method
  GLib.IOStatus `` `` Returns the text read. Location of line terminator. Reads the next line in the channel. An operation status value.
- Method
  GLib.IOStatus `` Returns the text read. Reads to the end of the channel. An operation status value.
- Method
  GLib.IOStatus `` Returns the UCS4 character. Reads a UCS4 character from the channel. An operation status value.
- Method
  GLib.IOStatus `` `` Byte offset. Base position. Seeks to a position in the channel. An operation status value.
- Method
  GLib.IOStatus `` A boolean indicating if buffer should be flushed. Shuts down a channel. An operation status value.
- Property
  System.Int32 UnixFd property. An integer representing the descriptor value.
- Method
  GLib.IOStatus `` `` Data buffer to write. Returns the number of bytes written. Writes binary data to a channel. An operation status value.
- Method
  GLib.IOStatus `` `` Text to write. Returns unwritten text. Writes text to the channel. An operation status value.
- Method
  GLib.IOStatus `` A UCS4 character. Writes a UCS4 character to the channel. An operation status value.