1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>buffered_write_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="buffered_stream/write_some/overload2.html" title="buffered_stream::write_some (2 of 2 overloads)"> 10<link rel="next" href="buffered_write_stream/async_flush.html" title="buffered_write_stream::async_flush"> 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="buffered_stream/write_some/overload2.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_write_stream/async_flush.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_write_stream"></a><a class="link" href="buffered_write_stream.html" title="buffered_write_stream">buffered_write_stream</a> 28</h3></div></div></div> 29<p> 30 Adds buffering to the write-related operations of a stream. 31 </p> 32<pre class="programlisting">template< 33 typename Stream> 34class buffered_write_stream : 35 noncopyable 36</pre> 37<h5> 38<a name="boost_asio.reference.buffered_write_stream.h0"></a> 39 <span class="phrase"><a name="boost_asio.reference.buffered_write_stream.types"></a></span><a class="link" href="buffered_write_stream.html#boost_asio.reference.buffered_write_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_write_stream/executor_type.html" title="buffered_write_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_write_stream/lowest_layer_type.html" title="buffered_write_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_write_stream/next_layer_type.html" title="buffered_write_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_write_stream.h1"></a> 99 <span class="phrase"><a name="boost_asio.reference.buffered_write_stream.member_functions"></a></span><a class="link" href="buffered_write_stream.html#boost_asio.reference.buffered_write_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_write_stream/async_flush.html" title="buffered_write_stream::async_flush"><span class="bold"><strong>async_flush</strong></span></a> 124 </p> 125 </td> 126<td> 127 <p> 128 Start an asynchronous flush. 129 </p> 130 </td> 131</tr> 132<tr> 133<td> 134 <p> 135 <a class="link" href="buffered_write_stream/async_read_some.html" title="buffered_write_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_write_stream/async_write_some.html" title="buffered_write_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_write_stream/buffered_write_stream.html" title="buffered_write_stream::buffered_write_stream"><span class="bold"><strong>buffered_write_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_write_stream/close.html" title="buffered_write_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_write_stream/flush.html" title="buffered_write_stream::flush"><span class="bold"><strong>flush</strong></span></a> 187 </p> 188 </td> 189<td> 190 <p> 191 Flush all data from the buffer to the next layer. Returns the number 192 of bytes written to the next layer on the last write operation. 193 Throws an exception on failure. <br> <span class="silver"> —</span><br> Flush all data from 194 the buffer to the next layer. Returns the number of bytes written 195 to the next layer on the last write operation, or 0 if an error 196 occurred. 197 </p> 198 </td> 199</tr> 200<tr> 201<td> 202 <p> 203 <a class="link" href="buffered_write_stream/get_executor.html" title="buffered_write_stream::get_executor"><span class="bold"><strong>get_executor</strong></span></a> 204 </p> 205 </td> 206<td> 207 <p> 208 Get the executor associated with the object. 209 </p> 210 </td> 211</tr> 212<tr> 213<td> 214 <p> 215 <a class="link" href="buffered_write_stream/in_avail.html" title="buffered_write_stream::in_avail"><span class="bold"><strong>in_avail</strong></span></a> 216 </p> 217 </td> 218<td> 219 <p> 220 Determine the amount of data that may be read without blocking. 221 </p> 222 </td> 223</tr> 224<tr> 225<td> 226 <p> 227 <a class="link" href="buffered_write_stream/lowest_layer.html" title="buffered_write_stream::lowest_layer"><span class="bold"><strong>lowest_layer</strong></span></a> 228 </p> 229 </td> 230<td> 231 <p> 232 Get a reference to the lowest layer. <br> <span class="silver"> —</span><br> Get a const 233 reference to the lowest layer. 234 </p> 235 </td> 236</tr> 237<tr> 238<td> 239 <p> 240 <a class="link" href="buffered_write_stream/next_layer.html" title="buffered_write_stream::next_layer"><span class="bold"><strong>next_layer</strong></span></a> 241 </p> 242 </td> 243<td> 244 <p> 245 Get a reference to the next layer. 246 </p> 247 </td> 248</tr> 249<tr> 250<td> 251 <p> 252 <a class="link" href="buffered_write_stream/peek.html" title="buffered_write_stream::peek"><span class="bold"><strong>peek</strong></span></a> 253 </p> 254 </td> 255<td> 256 <p> 257 Peek at the incoming data on the stream. Returns the number of 258 bytes read. Throws an exception on failure. <br> <span class="silver"> —</span><br> Peek 259 at the incoming data on the stream. Returns the number of bytes 260 read, or 0 if an error occurred. 261 </p> 262 </td> 263</tr> 264<tr> 265<td> 266 <p> 267 <a class="link" href="buffered_write_stream/read_some.html" title="buffered_write_stream::read_some"><span class="bold"><strong>read_some</strong></span></a> 268 </p> 269 </td> 270<td> 271 <p> 272 Read some data from the stream. Returns the number of bytes read. 273 Throws an exception on failure. <br> <span class="silver"> —</span><br> Read some data from 274 the stream. Returns the number of bytes read or 0 if an error occurred. 275 </p> 276 </td> 277</tr> 278<tr> 279<td> 280 <p> 281 <a class="link" href="buffered_write_stream/write_some.html" title="buffered_write_stream::write_some"><span class="bold"><strong>write_some</strong></span></a> 282 </p> 283 </td> 284<td> 285 <p> 286 Write the given data to the stream. Returns the number of bytes 287 written. Throws an exception on failure. <br> <span class="silver"> —</span><br> Write the 288 given data to the stream. Returns the number of bytes written, 289 or 0 if an error occurred and the error handler did not throw. 290 </p> 291 </td> 292</tr> 293</tbody> 294</table></div> 295<h5> 296<a name="boost_asio.reference.buffered_write_stream.h2"></a> 297 <span class="phrase"><a name="boost_asio.reference.buffered_write_stream.data_members"></a></span><a class="link" href="buffered_write_stream.html#boost_asio.reference.buffered_write_stream.data_members">Data Members</a> 298 </h5> 299<div class="informaltable"><table class="table"> 300<colgroup> 301<col> 302<col> 303</colgroup> 304<thead><tr> 305<th> 306 <p> 307 Name 308 </p> 309 </th> 310<th> 311 <p> 312 Description 313 </p> 314 </th> 315</tr></thead> 316<tbody><tr> 317<td> 318 <p> 319 <a class="link" href="buffered_write_stream/default_buffer_size.html" title="buffered_write_stream::default_buffer_size"><span class="bold"><strong>default_buffer_size</strong></span></a> <span class="silver">[static]</span> 320 </p> 321 </td> 322<td> 323 <p> 324 The default buffer size. 325 </p> 326 </td> 327</tr></tbody> 328</table></div> 329<p> 330 The <a class="link" href="buffered_write_stream.html" title="buffered_write_stream"><code class="computeroutput">buffered_write_stream</code></a> 331 class template can be used to add buffering to the synchronous and asynchronous 332 write operations of a stream. 333 </p> 334<h5> 335<a name="boost_asio.reference.buffered_write_stream.h3"></a> 336 <span class="phrase"><a name="boost_asio.reference.buffered_write_stream.thread_safety"></a></span><a class="link" href="buffered_write_stream.html#boost_asio.reference.buffered_write_stream.thread_safety">Thread 337 Safety</a> 338 </h5> 339<p> 340 <span class="emphasis"><em>Distinct</em></span> <span class="emphasis"><em>objects:</em></span> Safe. 341 </p> 342<p> 343 <span class="emphasis"><em>Shared</em></span> <span class="emphasis"><em>objects:</em></span> Unsafe. 344 </p> 345<h5> 346<a name="boost_asio.reference.buffered_write_stream.h4"></a> 347 <span class="phrase"><a name="boost_asio.reference.buffered_write_stream.requirements"></a></span><a class="link" href="buffered_write_stream.html#boost_asio.reference.buffered_write_stream.requirements">Requirements</a> 348 </h5> 349<p> 350 <span class="emphasis"><em>Header: </em></span><code class="literal">boost/asio/buffered_write_stream.hpp</code> 351 </p> 352<p> 353 <span class="emphasis"><em>Convenience header: </em></span><code class="literal">boost/asio.hpp</code> 354 </p> 355</div> 356<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 357<td align="left"></td> 358<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M. 359 Kohlhoff<p> 360 Distributed under the Boost Software License, Version 1.0. (See accompanying 361 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>) 362 </p> 363</div></td> 364</tr></table> 365<hr> 366<div class="spirit-nav"> 367<a accesskey="p" href="buffered_stream/write_some/overload2.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_write_stream/async_flush.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 368</div> 369</body> 370</html> 371