LibvirtGObject.Stream

g GObject.Object GObject.Object Gio.IOStream Gio.IOStream GObject.Object->Gio.IOStream LibvirtGObject.Stream LibvirtGObject.Stream Gio.IOStream->LibvirtGObject.Stream

Subclasses:

None

Methods

Inherited:

Gio.IOStream (11), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

add_watch (priority, cond, func, *opaque)

receive (buffer, cancellable)

receive_all (cancellable, func, *user_data)

send (buffer, size, cancellable)

send_all (cancellable, func, *user_data)

Virtual Methods

Inherited:

Gio.IOStream (5), GObject.Object (7)

Properties

Inherited:

Gio.IOStream (3)

Name

Type

Flags

Short Description

handle

r/w/co

The stream handle

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

Gio.IOStream

r

Class Details

class LibvirtGObject.Stream(**kwargs)
Bases:

Gio.IOStream

Abstract:

No

Structure:

LibvirtGObject.StreamClass

add_watch(priority, cond, func, *opaque)
Parameters:
Returns:

the event source id

Return type:

int

Adds a watch for self to the mainloop

receive(buffer, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

Number of bytes read, or 0 if the end of stream reached, or -1 on error.

Return type:

int

Receive data (up to size bytes) from a stream. On error -1 is returned and error is set accordingly.

LibvirtGObject.Stream.receive() can return any number of bytes, up to size. If more than size bytes have been received, the additional data will be returned in future calls to LibvirtGObject.Stream.receive().

If there is no data available, a Gio.IOErrorEnum.WOULD_BLOCK error will be returned.

receive_all(cancellable, func, *user_data)
Parameters:
Raises:

GLib.Error

Returns:

the number of bytes consumed or -1 upon error

Return type:

int

Receive the entire data stream, sending the data to the requested data sink. This is simply a convenient alternative to virStreamRecv, for apps that do blocking-I/o.

send(buffer, size, cancellable)
Parameters:
  • buffer (str) – a buffer to write data from (which should be at least size bytes long).

  • size (int) – the number of bytes you want to write to the stream

  • cancellable (Gio.Cancellable or None) – a Gio.Cancellable or None

Raises:

GLib.Error

Returns:

Number of bytes written.

Return type:

int

Send data (up to size bytes) from a stream. On error -1 is returned and error is set accordingly.

LibvirtGObject.Stream.send() can return any number of bytes, up to size. If more than size bytes have been sendd, the additional data will be returned in future calls to LibvirtGObject.Stream.send().

If there is no data available, a Gio.IOErrorEnum.WOULD_BLOCK error will be returned.

send_all(cancellable, func, *user_data)
Parameters:
Raises:

GLib.Error

Returns:

the number of bytes consumed or -1 upon error

Return type:

int

Send the entire data stream, sending the data to the requested data source. This is simply a convenient alternative to virStreamRecv, for apps that do blocking-I/o.

Property Details

LibvirtGObject.Stream.props.handle
Name:

handle

Type:

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The stream handle