### Constructor

# Camel StreamBuffer new

#### Declaration [src]

    CamelStream*
    camel_stream_buffer_new (
      CamelStream* stream,
      CamelStreamBufferMode mode
    )

#### Description [src]

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_STREAM_BUFFER_BUFFER, Buffer the input/output in blocks.

# CAMEL_STREAM_BUFFER_NEWLINE, Buffer on newlines (for output).

# CAMEL_STREAM_BUFFER_NONE, Perform no buffering.

Note that currently this is ignored and #CAMEL_STREAM_BUFFER_BUFFER is always used.

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

# CAMEL_STREAM_BUFFER_WRITE, Buffer in write mode.

# CAMEL_STREAM_BUFFER_READ, Buffer in read mode.

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

#### Parameters

`stream`

  Type: `CamelStream`

  A `CamelStream` object to buffer.

  The data is owned by the caller of the function.

`mode`

  Type: `CamelStreamBufferMode`

  Operational mode of buffered stream.

#### Return value

Type: `CamelStream`

A newly created buffered stream.

The caller of the function takes ownership of the data, and is responsible for freeing it.