1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>buffered_read_stream</title> 5<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../boost_asio.html" title="Boost.Asio"> 8<link rel="up" href="../reference.html" title="Reference"> 9<link rel="prev" href="buffer_size.html" title="buffer_size"> 10<link rel="next" href="buffered_read_stream/async_fill.html" title="buffered_read_stream::async_fill"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td> 15<td align="center"><a href="../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="buffer_size.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="buffered_read_stream/async_fill.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h3 class="title"> 27<a name="boost_asio.reference.buffered_read_stream"></a><a class="link" href="buffered_read_stream.html" title="buffered_read_stream">buffered_read_stream</a> 28</h3></div></div></div> 29<p> 30 Adds buffering to the read-related operations of a stream. 31 </p> 32<pre class="programlisting">template< 33 typename Stream> 34class buffered_read_stream : 35 noncopyable 36</pre> 37<h5> 38<a name="boost_asio.reference.buffered_read_stream.h0"></a> 39 <span class="phrase"><a name="boost_asio.reference.buffered_read_stream.types"></a></span><a class="link" href="buffered_read_stream.html#boost_asio.reference.buffered_read_stream.types">Types</a> 40 </h5> 41<div class="informaltable"><table class="table"> 42<colgroup> 43<col> 44<col> 45</colgroup> 46<thead><tr> 47<th> 48 <p> 49 Name 50 </p> 51 </th> 52<th> 53 <p> 54 Description 55 </p> 56 </th> 57</tr></thead> 58<tbody> 59<tr> 60<td> 61 <p> 62 <a class="link" href="buffered_read_stream/executor_type.html" title="buffered_read_stream::executor_type"><span class="bold"><strong>executor_type</strong></span></a> 63 </p> 64 </td> 65<td> 66 <p> 67 The type of the executor associated with the object. 68 </p> 69 </td> 70</tr> 71<tr> 72<td> 73 <p> 74 <a class="link" href="buffered_read_stream/lowest_layer_type.html" title="buffered_read_stream::lowest_layer_type"><span class="bold"><strong>lowest_layer_type</strong></span></a> 75 </p> 76 </td> 77<td> 78 <p> 79 The type of the lowest layer. 80 </p> 81 </td> 82</tr> 83<tr> 84<td> 85 <p> 86 <a class="link" href="buffered_read_stream/next_layer_type.html" title="buffered_read_stream::next_layer_type"><span class="bold"><strong>next_layer_type</strong></span></a> 87 </p> 88 </td> 89<td> 90 <p> 91 The type of the next layer. 92 </p> 93 </td> 94</tr> 95</tbody> 96</table></div> 97<h5> 98<a name="boost_asio.reference.buffered_read_stream.h1"></a> 99 <span class="phrase"><a name="boost_asio.reference.buffered_read_stream.member_functions"></a></span><a class="link" href="buffered_read_stream.html#boost_asio.reference.buffered_read_stream.member_functions">Member 100 Functions</a> 101 </h5> 102<div class="informaltable"><table class="table"> 103<colgroup> 104<col> 105<col> 106</colgroup> 107<thead><tr> 108<th> 109 <p> 110 Name 111 </p> 112 </th> 113<th> 114 <p> 115 Description 116 </p> 117 </th> 118</tr></thead> 119<tbody> 120<tr> 121<td> 122 <p> 123 <a class="link" href="buffered_read_stream/async_fill.html" title="buffered_read_stream::async_fill"><span class="bold"><strong>async_fill</strong></span></a> 124 </p> 125 </td> 126<td> 127 <p> 128 Start an asynchronous fill. 129 </p> 130 </td> 131</tr> 132<tr> 133<td> 134 <p> 135 <a class="link" href="buffered_read_stream/async_read_some.html" title="buffered_read_stream::async_read_some"><span class="bold"><strong>async_read_some</strong></span></a> 136 </p> 137 </td> 138<td> 139 <p> 140 Start an asynchronous read. The buffer into which the data will 141 be read must be valid for the lifetime of the asynchronous operation. 142 </p> 143 </td> 144</tr> 145<tr> 146<td> 147 <p> 148 <a class="link" href="buffered_read_stream/async_write_some.html" title="buffered_read_stream::async_write_some"><span class="bold"><strong>async_write_some</strong></span></a> 149 </p> 150 </td> 151<td> 152 <p> 153 Start an asynchronous write. The data being written must be valid 154 for the lifetime of the asynchronous operation. 155 </p> 156 </td> 157</tr> 158<tr> 159<td> 160 <p> 161 <a class="link" href="buffered_read_stream/buffered_read_stream.html" title="buffered_read_stream::buffered_read_stream"><span class="bold"><strong>buffered_read_stream</strong></span></a> <span class="silver">[constructor]</span> 162 </p> 163 </td> 164<td> 165 <p> 166 Construct, passing the specified argument to initialise the next 167 layer. 168 </p> 169 </td> 170</tr> 171<tr> 172<td> 173 <p> 174 <a class="link" href="buffered_read_stream/close.html" title="buffered_read_stream::close"><span class="bold"><strong>close</strong></span></a> 175 </p> 176 </td> 177<td> 178 <p> 179 Close the stream. 180 </p> 181 </td> 182</tr> 183<tr> 184<td> 185 <p> 186 <a class="link" href="buffered_read_stream/fill.html" title="buffered_read_stream::fill"><span class="bold"><strong>fill</strong></span></a> 187 </p> 188 </td> 189<td> 190 <p> 191 Fill the buffer with some data. Returns the number of bytes placed 192 in the buffer as a result of the operation. Throws an exception 193 on failure. <br> <span class="silver"> —</span><br> Fill the buffer with some data. Returns 194 the number of bytes placed in the buffer as a result of the operation, 195 or 0 if an error occurred. 196 </p> 197 </td> 198</tr> 199<tr> 200<td> 201 <p> 202 <a class="link" href="buffered_read_stream/get_executor.html" title="buffered_read_stream::get_executor"><span class="bold"><strong>get_executor</strong></span></a> 203 </p> 204 </td> 205<td> 206 <p> 207 Get the executor associated with the object. 208 </p> 209 </td> 210</tr> 211<tr> 212<td> 213 <p> 214 <a class="link" href="buffered_read_stream/in_avail.html" title="buffered_read_stream::in_avail"><span class="bold"><strong>in_avail</strong></span></a> 215 </p> 216 </td> 217<td> 218 <p> 219 Determine the amount of data that may be read without blocking. 220 </p> 221 </td> 222</tr> 223<tr> 224<td> 225 <p> 226 <a class="link" href="buffered_read_stream/lowest_layer.html" title="buffered_read_stream::lowest_layer"><span class="bold"><strong>lowest_layer</strong></span></a> 227 </p> 228 </td> 229<td> 230 <p> 231 Get a reference to the lowest layer. <br> <span class="silver"> —</span><br> Get a const 232 reference to the lowest layer. 233 </p> 234 </td> 235</tr> 236<tr> 237<td> 238 <p> 239 <a class="link" href="buffered_read_stream/next_layer.html" title="buffered_read_stream::next_layer"><span class="bold"><strong>next_layer</strong></span></a> 240 </p> 241 </td> 242<td> 243 <p> 244 Get a reference to the next layer. 245 </p> 246 </td> 247</tr> 248<tr> 249<td> 250 <p> 251 <a class="link" href="buffered_read_stream/peek.html" title="buffered_read_stream::peek"><span class="bold"><strong>peek</strong></span></a> 252 </p> 253 </td> 254<td> 255 <p> 256 Peek at the incoming data on the stream. Returns the number of 257 bytes read. Throws an exception on failure. <br> <span class="silver"> —</span><br> Peek 258 at the incoming data on the stream. Returns the number of bytes 259 read, or 0 if an error occurred. 260 </p> 261 </td> 262</tr> 263<tr> 264<td> 265 <p> 266 <a class="link" href="buffered_read_stream/read_some.html" title="buffered_read_stream::read_some"><span class="bold"><strong>read_some</strong></span></a> 267 </p> 268 </td> 269<td> 270 <p> 271 Read some data from the stream. Returns the number of bytes read. 272 Throws an exception on failure. <br> <span class="silver"> —</span><br> Read some data from 273 the stream. Returns the number of bytes read or 0 if an error occurred. 274 </p> 275 </td> 276</tr> 277<tr> 278<td> 279 <p> 280 <a class="link" href="buffered_read_stream/write_some.html" title="buffered_read_stream::write_some"><span class="bold"><strong>write_some</strong></span></a> 281 </p> 282 </td> 283<td> 284 <p> 285 Write the given data to the stream. Returns the number of bytes 286 written. Throws an exception on failure. <br> <span class="silver"> —</span><br> Write the 287 given data to the stream. Returns the number of bytes written, 288 or 0 if an error occurred. 289 </p> 290 </td> 291</tr> 292</tbody> 293</table></div> 294<h5> 295<a name="boost_asio.reference.buffered_read_stream.h2"></a> 296 <span class="phrase"><a name="boost_asio.reference.buffered_read_stream.data_members"></a></span><a class="link" href="buffered_read_stream.html#boost_asio.reference.buffered_read_stream.data_members">Data Members</a> 297 </h5> 298<div class="informaltable"><table class="table"> 299<colgroup> 300<col> 301<col> 302</colgroup> 303<thead><tr> 304<th> 305 <p> 306 Name 307 </p> 308 </th> 309<th> 310 <p> 311 Description 312 </p> 313 </th> 314</tr></thead> 315<tbody><tr> 316<td> 317 <p> 318 <a class="link" href="buffered_read_stream/default_buffer_size.html" title="buffered_read_stream::default_buffer_size"><span class="bold"><strong>default_buffer_size</strong></span></a> <span class="silver">[static]</span> 319 </p> 320 </td> 321<td> 322 <p> 323 The default buffer size. 324 </p> 325 </td> 326</tr></tbody> 327</table></div> 328<p> 329 The <a class="link" href="buffered_read_stream.html" title="buffered_read_stream"><code class="computeroutput">buffered_read_stream</code></a> 330 class template can be used to add buffering to the synchronous and asynchronous 331 read operations of a stream. 332 </p> 333<h5> 334<a name="boost_asio.reference.buffered_read_stream.h3"></a> 335 <span class="phrase"><a name="boost_asio.reference.buffered_read_stream.thread_safety"></a></span><a class="link" href="buffered_read_stream.html#boost_asio.reference.buffered_read_stream.thread_safety">Thread 336 Safety</a> 337 </h5> 338<p> 339 <span class="emphasis"><em>Distinct</em></span> <span class="emphasis"><em>objects:</em></span> Safe. 340 </p> 341<p> 342 <span class="emphasis"><em>Shared</em></span> <span class="emphasis"><em>objects:</em></span> Unsafe. 343 </p> 344<h5> 345<a name="boost_asio.reference.buffered_read_stream.h4"></a> 346 <span class="phrase"><a name="boost_asio.reference.buffered_read_stream.requirements"></a></span><a class="link" href="buffered_read_stream.html#boost_asio.reference.buffered_read_stream.requirements">Requirements</a> 347 </h5> 348<p> 349 <span class="emphasis"><em>Header: </em></span><code class="literal">boost/asio/buffered_read_stream.hpp</code> 350 </p> 351<p> 352 <span class="emphasis"><em>Convenience header: </em></span><code class="literal">boost/asio.hpp</code> 353 </p> 354</div> 355<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 356<td align="left"></td> 357<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M. 358 Kohlhoff<p> 359 Distributed under the Boost Software License, Version 1.0. (See accompanying 360 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 361 </p> 362</div></td> 363</tr></table> 364<hr> 365<div class="spirit-nav"> 366<a accesskey="p" href="buffer_size.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="buffered_read_stream/async_fill.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 367</div> 368</body> 369</html> 370