Camel.StreamBuffer

g Camel.Stream Camel.Stream Camel.StreamBuffer Camel.StreamBuffer Camel.Stream->Camel.StreamBuffer 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:

None

Methods

Inherited:

Camel.Stream (10), GObject.Object (37), Gio.Seekable (5)

Structs:

GObject.ObjectClass (5)

class

new (stream, mode)

discard_cache ()

gets (buf, cancellable)

read_line (cancellable)

Virtual Methods

Inherited:

Camel.Stream (5), GObject.Object (7), Gio.Seekable (5)

do_init (stream, mode)

do_init_vbuf (stream, mode, buf, size)

Properties

Inherited:

Camel.Stream (1)

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

Camel.Stream

r

Class Details

class Camel.StreamBuffer(**kwargs)
Bases:

Camel.Stream

Abstract:

No

Structure:

Camel.StreamBufferClass

classmethod new(stream, mode)
Parameters:
Returns:

a newly created buffered stream.

Return type:

Camel.Stream

Create a new buffered stream of another stream. A default buffer size (1024 bytes), automatically managed will be used for buffering.

The following values are available for mode:

Camel.StreamBufferMode.BUFFER, Buffer the input/output in blocks. #CAMEL_STREAM_BUFFER_NEWLINE, Buffer on newlines (for output). Camel.StreamBufferMode.NONE, Perform no buffering.

Note that currently this is ignored and Camel.StreamBufferMode.BUFFER is always used.

In addition, one of the following mode options should be or’d together with the buffering mode:

Camel.StreamBufferMode.WRITE, Buffer in write mode. Camel.StreamBufferMode.READ, Buffer in read mode.

Buffering can only be done in one direction for any buffer instance.

discard_cache()

Discards any cached data in the self. The next read reads from the stream.

New in version 3.38.

gets(buf, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

the number of characters read, or 0 for end of file, and -1 on error.

Return type:

int

Read a line of characters up to the next newline character or max-1 characters.

If the newline character is encountered, then it will be included in the buffer buf. The buffer will be None terminated.

read_line(cancellable)
Parameters:

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

Raises:

GLib.Error

Returns:

the line read, which the caller must free when done with, or None on eof. If an error occurs, error will be set.

Return type:

str or None

This function reads a complete newline-terminated line from the stream and returns it in allocated memory. The trailing newline (and carriage return if any) are not included in the returned string.

do_init(stream, mode) virtual
Parameters:
do_init_vbuf(stream, mode, buf, size) virtual
Parameters: