Camel.Stream

g Camel.Stream Camel.Stream GObject.GInterface GObject.GInterface Gio.Seekable Gio.Seekable GObject.GInterface->Gio.Seekable GObject.Object GObject.Object GObject.Object->Camel.Stream Gio.Seekable->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)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

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) – a Gio.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 or None) – optional Gio.Cancellable object, or None

Raises:

GLib.Error

Returns:

0 on success or -1 on error.

Return type:

int

Closes the stream.

eos()
Returns:

True on EOS or False otherwise.

Return type:

bool

Tests if there are bytes left to read on the self object.

flush(cancellable)
Parameters:

cancellable (Gio.Cancellable or None) – optional Gio.Cancellable object, or None

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:
Raises:

GLib.Error

Returns:

the number of bytes actually read, or -1 on error and set errno.

Return type:

int

Attempts to read up to n bytes from self into buffer.

ref_base_stream()
Returns:

a Gio.IOStream, or None

Return type:

Gio.IOStream or None

Returns the Gio.IOStream for self. This is only valid if self was created with Camel.Stream.new(). For all other Camel.Stream subclasses this function returns None.

The returned Gio.IOStream is referenced for thread-safety and should be unreferenced with GObject.Object.unref() when finished with it.

New in version 3.12.

set_base_stream(base_stream)
Parameters:

base_stream (Gio.IOStream) – a Gio.IOStream

Replaces the Gio.IOStream passed to Camel.Stream.new() with base_stream. The new base_stream should wrap the original Gio.IOStream, such as when adding Transport Layer Security after issuing a STARTTLS command.

New in version 3.12.

write(buffer, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

the number of bytes written to the stream, or -1 on error along with setting errno.

Return type:

int

Attempts to write up to n bytes of buffer into self.

write_string(string, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

the number of characters written or -1 on error.

Return type:

int

Writes the string to the stream.

write_to_stream(output_stream, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

-1 on error, or the number of bytes successfully copied across streams.

Return type:

int

Write all of a stream (until eos) into another stream, in a blocking fashion.

do_close(cancellable) virtual
Parameters:

cancellable (Gio.Cancellable or None) – optional Gio.Cancellable object, or None

Returns:

0 on success or -1 on error.

Return type:

int

Closes the stream.

do_eos() virtual
Returns:

True on EOS or False otherwise.

Return type:

bool

Tests if there are bytes left to read on the stream object.

do_flush(cancellable) virtual
Parameters:

cancellable (Gio.Cancellable or None) – optional Gio.Cancellable object, or None

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:
Returns:

the number of bytes actually read, or -1 on error and set errno.

Return type:

int

Attempts to read up to n bytes from stream into buffer.

do_write(buffer, cancellable) virtual
Parameters:
Returns:

the number of bytes written to the stream, or -1 on error along with setting errno.

Return type:

int

Attempts to write up to n bytes of buffer into stream.

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