• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>buffered_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_read_stream/write_some/overload2.html" title="buffered_read_stream::write_some (2 of 2 overloads)">
10<link rel="next" href="buffered_stream/async_fill.html" title="buffered_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="buffered_read_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_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_stream"></a><a class="link" href="buffered_stream.html" title="buffered_stream">buffered_stream</a>
28</h3></div></div></div>
29<p>
30        Adds buffering to the read- and write-related operations of a stream.
31      </p>
32<pre class="programlisting">template&lt;
33    typename Stream&gt;
34class buffered_stream :
35  noncopyable
36</pre>
37<h5>
38<a name="boost_asio.reference.buffered_stream.h0"></a>
39        <span class="phrase"><a name="boost_asio.reference.buffered_stream.types"></a></span><a class="link" href="buffered_stream.html#boost_asio.reference.buffered_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_stream/executor_type.html" title="buffered_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_stream/lowest_layer_type.html" title="buffered_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_stream/next_layer_type.html" title="buffered_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_stream.h1"></a>
99        <span class="phrase"><a name="boost_asio.reference.buffered_stream.member_functions"></a></span><a class="link" href="buffered_stream.html#boost_asio.reference.buffered_stream.member_functions">Member Functions</a>
100      </h5>
101<div class="informaltable"><table class="table">
102<colgroup>
103<col>
104<col>
105</colgroup>
106<thead><tr>
107<th>
108                <p>
109                  Name
110                </p>
111              </th>
112<th>
113                <p>
114                  Description
115                </p>
116              </th>
117</tr></thead>
118<tbody>
119<tr>
120<td>
121                <p>
122                  <a class="link" href="buffered_stream/async_fill.html" title="buffered_stream::async_fill"><span class="bold"><strong>async_fill</strong></span></a>
123                </p>
124              </td>
125<td>
126                <p>
127                  Start an asynchronous fill.
128                </p>
129              </td>
130</tr>
131<tr>
132<td>
133                <p>
134                  <a class="link" href="buffered_stream/async_flush.html" title="buffered_stream::async_flush"><span class="bold"><strong>async_flush</strong></span></a>
135                </p>
136              </td>
137<td>
138                <p>
139                  Start an asynchronous flush.
140                </p>
141              </td>
142</tr>
143<tr>
144<td>
145                <p>
146                  <a class="link" href="buffered_stream/async_read_some.html" title="buffered_stream::async_read_some"><span class="bold"><strong>async_read_some</strong></span></a>
147                </p>
148              </td>
149<td>
150                <p>
151                  Start an asynchronous read. The buffer into which the data will
152                  be read must be valid for the lifetime of the asynchronous operation.
153                </p>
154              </td>
155</tr>
156<tr>
157<td>
158                <p>
159                  <a class="link" href="buffered_stream/async_write_some.html" title="buffered_stream::async_write_some"><span class="bold"><strong>async_write_some</strong></span></a>
160                </p>
161              </td>
162<td>
163                <p>
164                  Start an asynchronous write. The data being written must be valid
165                  for the lifetime of the asynchronous operation.
166                </p>
167              </td>
168</tr>
169<tr>
170<td>
171                <p>
172                  <a class="link" href="buffered_stream/buffered_stream.html" title="buffered_stream::buffered_stream"><span class="bold"><strong>buffered_stream</strong></span></a> <span class="silver">[constructor]</span>
173                </p>
174              </td>
175<td>
176                <p>
177                  Construct, passing the specified argument to initialise the next
178                  layer.
179                </p>
180              </td>
181</tr>
182<tr>
183<td>
184                <p>
185                  <a class="link" href="buffered_stream/close.html" title="buffered_stream::close"><span class="bold"><strong>close</strong></span></a>
186                </p>
187              </td>
188<td>
189                <p>
190                  Close the stream.
191                </p>
192              </td>
193</tr>
194<tr>
195<td>
196                <p>
197                  <a class="link" href="buffered_stream/fill.html" title="buffered_stream::fill"><span class="bold"><strong>fill</strong></span></a>
198                </p>
199              </td>
200<td>
201                <p>
202                  Fill the buffer with some data. Returns the number of bytes placed
203                  in the buffer as a result of the operation. Throws an exception
204                  on failure. <br> <span class="silver"> —</span><br> Fill the buffer with some data. Returns
205                  the number of bytes placed in the buffer as a result of the operation,
206                  or 0 if an error occurred.
207                </p>
208              </td>
209</tr>
210<tr>
211<td>
212                <p>
213                  <a class="link" href="buffered_stream/flush.html" title="buffered_stream::flush"><span class="bold"><strong>flush</strong></span></a>
214                </p>
215              </td>
216<td>
217                <p>
218                  Flush all data from the buffer to the next layer. Returns the number
219                  of bytes written to the next layer on the last write operation.
220                  Throws an exception on failure. <br> <span class="silver"> —</span><br> Flush all data from
221                  the buffer to the next layer. Returns the number of bytes written
222                  to the next layer on the last write operation, or 0 if an error
223                  occurred.
224                </p>
225              </td>
226</tr>
227<tr>
228<td>
229                <p>
230                  <a class="link" href="buffered_stream/get_executor.html" title="buffered_stream::get_executor"><span class="bold"><strong>get_executor</strong></span></a>
231                </p>
232              </td>
233<td>
234                <p>
235                  Get the executor associated with the object.
236                </p>
237              </td>
238</tr>
239<tr>
240<td>
241                <p>
242                  <a class="link" href="buffered_stream/in_avail.html" title="buffered_stream::in_avail"><span class="bold"><strong>in_avail</strong></span></a>
243                </p>
244              </td>
245<td>
246                <p>
247                  Determine the amount of data that may be read without blocking.
248                </p>
249              </td>
250</tr>
251<tr>
252<td>
253                <p>
254                  <a class="link" href="buffered_stream/lowest_layer.html" title="buffered_stream::lowest_layer"><span class="bold"><strong>lowest_layer</strong></span></a>
255                </p>
256              </td>
257<td>
258                <p>
259                  Get a reference to the lowest layer. <br> <span class="silver"> —</span><br> Get a const
260                  reference to the lowest layer.
261                </p>
262              </td>
263</tr>
264<tr>
265<td>
266                <p>
267                  <a class="link" href="buffered_stream/next_layer.html" title="buffered_stream::next_layer"><span class="bold"><strong>next_layer</strong></span></a>
268                </p>
269              </td>
270<td>
271                <p>
272                  Get a reference to the next layer.
273                </p>
274              </td>
275</tr>
276<tr>
277<td>
278                <p>
279                  <a class="link" href="buffered_stream/peek.html" title="buffered_stream::peek"><span class="bold"><strong>peek</strong></span></a>
280                </p>
281              </td>
282<td>
283                <p>
284                  Peek at the incoming data on the stream. Returns the number of
285                  bytes read. Throws an exception on failure. <br> <span class="silver"> —</span><br> Peek
286                  at the incoming data on the stream. Returns the number of bytes
287                  read, or 0 if an error occurred.
288                </p>
289              </td>
290</tr>
291<tr>
292<td>
293                <p>
294                  <a class="link" href="buffered_stream/read_some.html" title="buffered_stream::read_some"><span class="bold"><strong>read_some</strong></span></a>
295                </p>
296              </td>
297<td>
298                <p>
299                  Read some data from the stream. Returns the number of bytes read.
300                  Throws an exception on failure. <br> <span class="silver"> —</span><br> Read some data from
301                  the stream. Returns the number of bytes read or 0 if an error occurred.
302                </p>
303              </td>
304</tr>
305<tr>
306<td>
307                <p>
308                  <a class="link" href="buffered_stream/write_some.html" title="buffered_stream::write_some"><span class="bold"><strong>write_some</strong></span></a>
309                </p>
310              </td>
311<td>
312                <p>
313                  Write the given data to the stream. Returns the number of bytes
314                  written. Throws an exception on failure. <br> <span class="silver"> —</span><br> Write the
315                  given data to the stream. Returns the number of bytes written,
316                  or 0 if an error occurred.
317                </p>
318              </td>
319</tr>
320</tbody>
321</table></div>
322<p>
323        The <a class="link" href="buffered_stream.html" title="buffered_stream"><code class="computeroutput">buffered_stream</code></a>
324        class template can be used to add buffering to the synchronous and asynchronous
325        read and write operations of a stream.
326      </p>
327<h5>
328<a name="boost_asio.reference.buffered_stream.h2"></a>
329        <span class="phrase"><a name="boost_asio.reference.buffered_stream.thread_safety"></a></span><a class="link" href="buffered_stream.html#boost_asio.reference.buffered_stream.thread_safety">Thread
330        Safety</a>
331      </h5>
332<p>
333        <span class="emphasis"><em>Distinct</em></span> <span class="emphasis"><em>objects:</em></span> Safe.
334      </p>
335<p>
336        <span class="emphasis"><em>Shared</em></span> <span class="emphasis"><em>objects:</em></span> Unsafe.
337      </p>
338<h5>
339<a name="boost_asio.reference.buffered_stream.h3"></a>
340        <span class="phrase"><a name="boost_asio.reference.buffered_stream.requirements"></a></span><a class="link" href="buffered_stream.html#boost_asio.reference.buffered_stream.requirements">Requirements</a>
341      </h5>
342<p>
343        <span class="emphasis"><em>Header: </em></span><code class="literal">boost/asio/buffered_stream.hpp</code>
344      </p>
345<p>
346        <span class="emphasis"><em>Convenience header: </em></span><code class="literal">boost/asio.hpp</code>
347      </p>
348</div>
349<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
350<td align="left"></td>
351<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
352      Kohlhoff<p>
353        Distributed under the Boost Software License, Version 1.0. (See accompanying
354        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>)
355      </p>
356</div></td>
357</tr></table>
358<hr>
359<div class="spirit-nav">
360<a accesskey="p" href="buffered_read_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_stream/async_fill.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
361</div>
362</body>
363</html>
364