Camel.Stream¶
Subclasses: | Camel.StreamBuffer , Camel.StreamFilter , Camel.StreamFs , Camel.StreamMem , Camel.StreamNull , Camel.StreamProcess |
---|
Methods¶
Inherited: | GObject.Object (37), Gio.Seekable (5) |
---|---|
Structs: | GObject.ObjectClass (5) |
class | new (base_stream) |
close (cancellable) |
|
eos () |
|
flush (cancellable) |
|
read (buffer, cancellable) |
|
ref_base_stream () |
|
set_base_stream (base_stream) |
|
write (buffer, cancellable) |
|
write_string (string, cancellable) |
|
write_to_stream (output_stream, cancellable) |
Virtual Methods¶
Inherited: | GObject.Object (7), Gio.Seekable (5) |
---|
do_close (cancellable) |
|
do_eos () |
|
do_flush (cancellable) |
|
do_read (buffer, cancellable) |
|
do_write (buffer, cancellable) |
Properties¶
Name | Type | Flags | Short Description |
---|---|---|---|
base-stream |
Gio.IOStream |
r/w/en | The base Gio.IOStream |
Signals¶
Inherited: | GObject.Object (1) |
---|
Class Details¶
-
class
Camel.
Stream
(**kwargs)¶ Bases: GObject.Object
,Gio.Seekable
Abstract: No Structure: Camel.StreamClass
-
classmethod
new
(base_stream)¶ Parameters: base_stream ( Gio.IOStream
) – aGio.IOStream
Returns: a Camel.Stream
Return type: Camel.Stream
Creates a
Camel.Stream
as a thin wrapper for base_stream.New in version 3.12.
-
close
(cancellable)¶ Parameters: cancellable ( Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
Raises: GLib.Error
Returns: 0 on success or -1 on error. Return type: int
Closes the stream.
-
eos
()¶ Returns: True
on EOS orFalse
otherwise.Return type: bool
Tests if there are bytes left to read on the self object.
-
flush
(cancellable)¶ Parameters: cancellable ( Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
Raises: GLib.Error
Returns: 0 on success or -1 on fail along with setting error Return type: int
Flushes any buffered data to the stream’s backing store. Only meaningful for writable streams.
-
read
(buffer, cancellable)¶ Parameters: - buffer ([
int
]) – output buffer - cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
Raises: Returns: the number of bytes actually read, or -1 on error and set errno.
Return type: Attempts to read up to n bytes from self into buffer.
- buffer ([
-
ref_base_stream
()¶ Returns: a Gio.IOStream
, orNone
Return type: Gio.IOStream
orNone
Returns the
Gio.IOStream
for self. This is only valid if self was created withCamel.Stream.new
(). For all otherCamel.Stream
subclasses this function returnsNone
.The returned
Gio.IOStream
is referenced for thread-safety and should be unreferenced withGObject.Object.unref
() when finished with it.New in version 3.12.
-
set_base_stream
(base_stream)¶ Parameters: base_stream ( Gio.IOStream
) – aGio.IOStream
Replaces the
Gio.IOStream
passed toCamel.Stream.new
() with base_stream. The new base_stream should wrap the originalGio.IOStream
, such as when adding Transport Layer Security after issuing a STARTTLS command.New in version 3.12.
-
write
(buffer, cancellable)¶ Parameters: - buffer ([
int
]) – buffer to write. - cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
Raises: Returns: the number of bytes written to the stream, or -1 on error along with setting errno.
Return type: Attempts to write up to n bytes of buffer into self.
- buffer ([
-
write_string
(string, cancellable)¶ Parameters: - string (
str
) – a string - cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
Raises: Returns: the number of characters written or -1 on error.
Return type: Writes the string to the stream.
- string (
-
write_to_stream
(output_stream, cancellable)¶ Parameters: - output_stream (
Camel.Stream
) – destinationCamel.Stream
object - cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
Raises: Returns: -1 on error, or the number of bytes succesfully copied across streams.
Return type: Write all of a stream (until eos) into another stream, in a blocking fashion.
- output_stream (
-
do_close
(cancellable) virtual¶ Parameters: cancellable ( Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
Returns: 0 on success or -1 on error. Return type: int
Closes the stream.
-
do_eos
() virtual¶ Returns: True
on EOS orFalse
otherwise.Return type: bool
Tests if there are bytes left to read on the stream object.
-
do_flush
(cancellable) virtual¶ Parameters: cancellable ( Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
Returns: 0 on success or -1 on fail along with setting error Return type: int
Flushes any buffered data to the stream’s backing store. Only meaningful for writable streams.
-
do_read
(buffer, cancellable) virtual¶ Parameters: - buffer ([
int
]) – output buffer - cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
Returns: the number of bytes actually read, or -1 on error and set errno.
Return type: Attempts to read up to n bytes from stream into buffer.
- buffer ([
-
do_write
(buffer, cancellable) virtual¶ Parameters: - buffer ([
int
]) – buffer to write. - cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
Returns: the number of bytes written to the stream, or -1 on error along with setting errno.
Return type: Attempts to write up to n bytes of buffer into stream.
- buffer ([
-
classmethod
Property Details¶
-
Camel.Stream.props.
base_stream
¶ Name: base-stream
Type: Gio.IOStream
Default Value: None
Flags: READABLE
,WRITABLE
,EXPLICIT_NOTIFY
The base
Gio.IOStream