Camel.StreamBuffer
Description: Reference for Camel.StreamBuffer

### Class

# CamelStreamBuffer

#### Description [src]

    class Camel.StreamBuffer : Camel.Stream
      implements Gio.Seekable {
      CamelStreamBufferPrivate* priv
    }

A buffering wrapper around a Camel stream.

`CamelStreamBuffer` wraps another `CamelStream` and provides buffering. All read and write operations are automatically buffered through virtual method overrides.

The additional `camel_stream_buffer_read_line()` method returns a complete line (up to the next newline) as a newly-allocated string, automatically converting \r\n sequences to \n and stripping them.

#### Hierarchy

#### Ancestors

- CamelStream
- GObject

#### Implements

- GSeekable

#### Constructors

###### camel_stream_buffer_new

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

#### Instance methods

###### camel_stream_buffer_discard_cache

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

since: 3.38

###### camel_stream_buffer_gets

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

###### camel_stream_buffer_read_line

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.

##### Methods inherited from CamelStream (9)

###### camel_stream_close

Closes the stream.

###### camel_stream_eos

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

###### camel_stream_flush

Flushes any buffered data to the stream’s backing store. Only meaningful for writable streams.

###### camel_stream_read

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

###### camel_stream_ref_base_stream

Returns the `GIOStream` for `stream`. This is only valid if `stream` was created with camel_stream_new(). For all other `CamelStream` subclasses this function returns `NULL`.

since: 3.12

###### camel_stream_set_base_stream

Replaces the `GIOStream` passed to `camel_stream_new()` with `base_stream`. The new `base_stream` should wrap the original `GIOStream`, such as when adding Transport Layer Security after issuing a STARTTLS command.

since: 3.12

###### camel_stream_write

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

###### camel_stream_write_string

Writes the string to the stream.

###### camel_stream_write_to_stream

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

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

##### Methods inherited from GSeekable (5)

###### g_seekable_can_seek

Tests if the stream supports the `GSeekableIface`.

###### g_seekable_can_truncate

Tests if the length of the stream can be adjusted with g_seekable_truncate().

###### g_seekable_seek

Seeks in the stream by the given `offset`, modified by `type`.

###### g_seekable_tell

Tells the current position within the stream.

###### g_seekable_truncate

Sets the length of the stream to `offset`. If the stream was previously larger than `offset`, the extra data is discarded. If the stream was previously shorter than `offset`, it is extended with NUL (‘\0’) bytes.

#### Properties

##### Properties inherited from CamelStream (1)

###### Camel.Stream:base-stream

The base `GIOStream`.

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct CamelStreamBufferClass {
      CamelStreamClass parent_class;
      void (* init) (
        CamelStreamBuffer* stream_buffer,
        CamelStream* stream,
        CamelStreamBufferMode mode
      );
      void (* init_vbuf) (
        CamelStreamBuffer* stream_buffer,
        CamelStream* stream,
        CamelStreamBufferMode mode,
        gchar* buf,
        guint32 size
      );
      gpointer reserved;

    }

No description available.

###### Class members

`parent_class: CamelStreamClass`

  No description available.

`init: void (* init) ( CamelStreamBuffer* stream_buffer, CamelStream* stream, CamelStreamBufferMode mode )`

  No description available.

`init_vbuf: void (* init_vbuf) ( CamelStreamBuffer* stream_buffer, CamelStream* stream, CamelStreamBufferMode mode, gchar* buf, guint32 size )`

  No description available.

`reserved: gpointer`

  No description available.

#### Virtual methods

###### Camel.StreamBufferClass.init

No description available.

###### Camel.StreamBufferClass.init_vbuf

No description available.