LibvirtGObject.Stream¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
The stream handle |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class LibvirtGObject.Stream(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- add_watch(priority, cond, func, *opaque)¶
- Parameters:
priority (
int
) – the priority of theLibvirtGObject.Stream
sourcecond (
LibvirtGObject.StreamIOCondition
) – the conditions to watch for (bitfield ofLibvirtGObject.StreamIOCondition
)func (
LibvirtGObject.StreamIOFunc
) – the function to call when the condition is satisfied
- Returns:
the event source id
- Return type:
Adds a watch for self to the mainloop
- receive(buffer, cancellable)¶
- Parameters:
buffer (
bytes
) – a buffer to read data into (which should be at least size bytes long).cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
- Raises:
- Returns:
Number of bytes read, or 0 if the end of stream reached, or -1 on error.
- Return type:
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 toLibvirtGObject.Stream.receive
().If there is no data available, a
Gio.IOErrorEnum.WOULD_BLOCK
error will be returned.
- receive_all(cancellable, func, *user_data)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – cancellation notifierfunc (
LibvirtGObject.StreamSinkFunc
) – the callback for writing data to application
- Raises:
- Returns:
the number of bytes consumed or -1 upon error
- Return type:
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 streamcancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
- Raises:
- Returns:
Number of bytes written.
- Return type:
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 toLibvirtGObject.Stream.send
().If there is no data available, a
Gio.IOErrorEnum.WOULD_BLOCK
error will be returned.
- send_all(cancellable, func, *user_data)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – cancellation notifierfunc (
LibvirtGObject.StreamSourceFunc
) – the callback for writing data to application
- Raises:
- Returns:
the number of bytes consumed or -1 upon error
- Return type:
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:
- Flags:
The stream handle