| Home | Libraries | People | FAQ | More

### buffered_read_stream

Adds buffering to the read-related operations of a stream.

    template<
        typename Stream>
    class buffered_read_stream :
      noncopyable

##### Types

Name | Description
--- | ---
lowest_layer_type | The type of the lowest layer.
next_layer_type | The type of the next layer.

##### Member Functions

Name | Description
--- | ---
async_fill | Start an asynchronous fill.
async_read_some | Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation.
async_write_some | Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation.
buffered_read_stream | Construct, passing the specified argument to initialise the next layer.
close | Close the stream.
fill | Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure. Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred.
get_io_service | Get the io_service associated with the object.
in_avail | Determine the amount of data that may be read without blocking.
lowest_layer | Get a reference to the lowest layer. Get a const reference to the lowest layer.
next_layer | Get a reference to the next layer.
peek | Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure. Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
read_some | Read some data from the stream. Returns the number of bytes read. Throws an exception on failure. Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
write_some | Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred.

##### Data Members

Name | Description
--- | ---
default_buffer_size | The default buffer size.

The `buffered_read_stream` class template can be used to add buffering to the synchronous and asynchronous read operations of a stream.

##### Thread Safety

Distinct objects: Safe.

Shared objects: Unsafe.

##### Requirements

Header: `boost/asio/buffered_read_stream.hpp`

Convenience header: `boost/asio.hpp`