File: qbuffer.html

package info (click to toggle)
qt4-x11 4%3A4.8.2%2Bdfsg-11
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 701,696 kB
  • sloc: cpp: 2,686,179; ansic: 375,485; python: 25,859; sh: 19,349; xml: 17,091; perl: 14,765; yacc: 5,383; asm: 5,038; makefile: 1,259; lex: 555; ruby: 526; objc: 347; cs: 112; pascal: 112; php: 54; sed: 34
file content (259 lines) | stat: -rw-r--r-- 23,414 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qbuffer.cpp -->
  <title>Qt 4.8: QBuffer Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="content"> 
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
  </div>
  <div class="breadcrumb toolblock">
    <ul>
      <li class="first"><a href="index.html">Home</a></li>
      <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtcore.html">QtCore</a></li>
<li>QBuffer</li>
    </ul>
  </div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QBuffer Class Reference</h1>
<!-- $$$QBuffer-brief -->
<p>The QBuffer class provides a <a href="qiodevice.html">QIODevice</a> interface for a <a href="qbytearray.html">QByteArray</a>. <a href="#details">More...</a></p>
<!-- @@@QBuffer -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QBuffer&gt;</span></pre><p><b>Inherits: </b><a href="qiodevice.html">QIODevice</a>.</p>
<p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p>
<ul>
<li><a href="qbuffer-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbuffer.html#QBuffer">QBuffer</a></b> ( QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbuffer.html#QBuffer-2">QBuffer</a></b> ( QByteArray * <i>byteArray</i>, QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbuffer.html#dtor.QBuffer">~QBuffer</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray &amp; </td><td class="memItemRight bottomAlign"><b><a href="qbuffer.html#buffer">buffer</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QByteArray &amp; </td><td class="memItemRight bottomAlign"><b><a href="qbuffer.html#buffer-2">buffer</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QByteArray &amp; </td><td class="memItemRight bottomAlign"><b><a href="qbuffer.html#data">data</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbuffer.html#setBuffer">setBuffer</a></b> ( QByteArray * <i>byteArray</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbuffer.html#setData">setData</a></b> ( const QByteArray &amp; <i>data</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbuffer.html#setData-2">setData</a></b> ( const char * <i>data</i>, int <i>size</i> )</td></tr>
</table>
<a name="reimplemented-public-functions"></a>
<h2>Reimplemented Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qbuffer.html#atEnd">atEnd</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qbuffer.html#canReadLine">canReadLine</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qbuffer.html#close">close</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qbuffer.html#open">open</a></b> ( OpenMode <i>flags</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual qint64 </td><td class="memItemRight bottomAlign"><b><a href="qbuffer.html#pos">pos</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qbuffer.html#seek">seek</a></b> ( qint64 <i>pos</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual qint64 </td><td class="memItemRight bottomAlign"><b><a href="qbuffer.html#size">size</a></b> () const</td></tr>
</table>
<ul>
<li class="fn">33 public functions inherited from <a href="qiodevice.html#public-functions">QIODevice</a></li>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<a name="reimplemented-protected-functions"></a>
<h2>Reimplemented Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual qint64 </td><td class="memItemRight bottomAlign"><b><a href="qbuffer.html#readData">readData</a></b> ( char * <i>data</i>, qint64 <i>len</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual qint64 </td><td class="memItemRight bottomAlign"><b><a href="qbuffer.html#writeData">writeData</a></b> ( const char * <i>data</i>, qint64 <i>len</i> )</td></tr>
</table>
<ul>
<li class="fn">5 protected functions inherited from <a href="qiodevice.html#protected-functions">QIODevice</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li class="fn">4 signals inherited from <a href="qiodevice.html#signals">QIODevice</a></li>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li class="fn">5 protected functions inherited from <a href="qiodevice.html#protected-functions">QIODevice</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QBuffer-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QBuffer class provides a <a href="qiodevice.html">QIODevice</a> interface for a <a href="qbytearray.html">QByteArray</a>.</p>
<p>QBuffer allows you to access a <a href="qbytearray.html">QByteArray</a> using the <a href="qiodevice.html">QIODevice</a> interface. The <a href="qbytearray.html">QByteArray</a> is treated just as a standard random-accessed file. Example:</p>
<pre class="cpp">     <span class="type">QBuffer</span> buffer;
     <span class="type">char</span> ch;

     buffer<span class="operator">.</span>open(<span class="type">QBuffer</span><span class="operator">::</span>ReadWrite);
     buffer<span class="operator">.</span>write(<span class="string">&quot;Qt rocks!&quot;</span>);
     buffer<span class="operator">.</span>seek(<span class="number">0</span>);
     buffer<span class="operator">.</span>getChar(<span class="operator">&amp;</span>ch);  <span class="comment">// ch == 'Q'</span>
     buffer<span class="operator">.</span>getChar(<span class="operator">&amp;</span>ch);  <span class="comment">// ch == 't'</span>
     buffer<span class="operator">.</span>getChar(<span class="operator">&amp;</span>ch);  <span class="comment">// ch == ' '</span>
     buffer<span class="operator">.</span>getChar(<span class="operator">&amp;</span>ch);  <span class="comment">// ch == 'r'</span></pre>
<p>By default, an internal <a href="qbytearray.html">QByteArray</a> buffer is created for you when you create a QBuffer. You can access this buffer directly by calling <a href="qbuffer.html#buffer">buffer</a>(). You can also use QBuffer with an existing <a href="qbytearray.html">QByteArray</a> by calling <a href="qbuffer.html#setBuffer">setBuffer</a>(), or by passing your array to QBuffer's constructor.</p>
<p>Call <a href="qbuffer.html#open">open</a>() to open the buffer. Then call <a href="qiodevice.html#write">write</a>() or <a href="qiodevice.html#putChar">putChar</a>() to write to the buffer, and <a href="qiodevice.html#read">read</a>(), <a href="qiodevice.html#readLine">readLine</a>(), <a href="qiodevice.html#readAll">readAll</a>(), or <a href="qiodevice.html#getChar">getChar</a>() to read from it. <a href="qbuffer.html#size">size</a>() returns the current size of the buffer, and you can seek to arbitrary positions in the buffer by calling <a href="qbuffer.html#seek">seek</a>(). When you are done with accessing the buffer, call <a href="qbuffer.html#close">close</a>().</p>
<p>The following code snippet shows how to write data to a <a href="qbytearray.html">QByteArray</a> using <a href="qdatastream.html">QDataStream</a> and QBuffer:</p>
<pre class="cpp">     <span class="type"><a href="qbytearray.html">QByteArray</a></span> byteArray;
     <span class="type">QBuffer</span> buffer(<span class="operator">&amp;</span>byteArray);
     buffer<span class="operator">.</span>open(<span class="type"><a href="qiodevice.html">QIODevice</a></span><span class="operator">::</span>WriteOnly);

     <span class="type"><a href="qdatastream.html">QDataStream</a></span> out(<span class="operator">&amp;</span>buffer);
     out <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="type"><a href="qapplication.html">QApplication</a></span><span class="operator">::</span>palette();</pre>
<p>Effectively, we convert the application's <a href="qpalette.html">QPalette</a> into a byte array. Here's how to read the data from the <a href="qbytearray.html">QByteArray</a>:</p>
<pre class="cpp">     <span class="type"><a href="qpalette.html">QPalette</a></span> palette;
     <span class="type">QBuffer</span> buffer(<span class="operator">&amp;</span>byteArray);
     buffer<span class="operator">.</span>open(<span class="type"><a href="qiodevice.html">QIODevice</a></span><span class="operator">::</span>ReadOnly);

     <span class="type"><a href="qdatastream.html">QDataStream</a></span> in(<span class="operator">&amp;</span>buffer);
     in <span class="operator">&gt;</span><span class="operator">&gt;</span> palette;</pre>
<p><a href="qtextstream.html">QTextStream</a> and <a href="qdatastream.html">QDataStream</a> also provide convenience constructors that take a <a href="qbytearray.html">QByteArray</a> and that create a QBuffer behind the scenes.</p>
<p>QBuffer emits <a href="qiodevice.html#readyRead">readyRead</a>() when new data has arrived in the buffer. By connecting to this signal, you can use QBuffer to store temporary data before processing it. For example, you can pass the buffer to <a href="qftp.html">QFtp</a> when downloading a file from an FTP server. Whenever a new payload of data has been downloaded, <a href="qiodevice.html#readyRead">readyRead</a>() is emitted, and you can process the data that just arrived. QBuffer also emits <a href="qiodevice.html#bytesWritten">bytesWritten</a>() every time new data has been written to the buffer.</p>
</div>
<p><b>See also </b><a href="qfile.html">QFile</a>, <a href="qdatastream.html">QDataStream</a>, <a href="qtextstream.html">QTextStream</a>, and <a href="qbytearray.html">QByteArray</a>.</p>
<!-- @@@QBuffer -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QBuffer[overload1]$$$QBufferQObject* -->
<h3 class="fn"><a name="QBuffer"></a>QBuffer::<span class="name">QBuffer</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>parent</i> = 0 )</h3>
<p>Constructs an empty buffer with the given <i>parent</i>. You can call <a href="qbuffer.html#setData">setData</a>() to fill the buffer with data, or you can open it in write mode and use <a href="qiodevice.html#write">write</a>().</p>
<p><b>See also </b><a href="qbuffer.html#open">open</a>().</p>
<!-- @@@QBuffer -->
<!-- $$$QBuffer$$$QBufferQByteArray*QObject* -->
<h3 class="fn"><a name="QBuffer-2"></a>QBuffer::<span class="name">QBuffer</span> ( <span class="type"><a href="qbytearray.html">QByteArray</a></span> * <i>byteArray</i>, <span class="type"><a href="qobject.html">QObject</a></span> * <i>parent</i> = 0 )</h3>
<p>Constructs a <a href="qbuffer.html">QBuffer</a> that uses the <a href="qbytearray.html">QByteArray</a> pointed to by <i>byteArray</i> as its internal buffer, and with the given <i>parent</i>. The caller is responsible for ensuring that <i>byteArray</i> remains valid until the <a href="qbuffer.html">QBuffer</a> is destroyed, or until <a href="qbuffer.html#setBuffer">setBuffer</a>() is called to change the buffer. <a href="qbuffer.html">QBuffer</a> doesn't take ownership of the <a href="qbytearray.html">QByteArray</a>.</p>
<p>If you open the buffer in write-only mode or read-write mode and write something into the <a href="qbuffer.html">QBuffer</a>, <i>byteArray</i> will be modified.</p>
<p>Example:</p>
<pre class="cpp">     <span class="type"><a href="qbytearray.html">QByteArray</a></span> byteArray(<span class="string">&quot;abc&quot;</span>);
     <span class="type"><a href="qbuffer.html">QBuffer</a></span> buffer(<span class="operator">&amp;</span>byteArray);
     buffer<span class="operator">.</span>open(<span class="type"><a href="qiodevice.html">QIODevice</a></span><span class="operator">::</span>WriteOnly);
     buffer<span class="operator">.</span>seek(<span class="number">3</span>);
     buffer<span class="operator">.</span>write(<span class="string">&quot;def&quot;</span><span class="operator">,</span> <span class="number">3</span>);
     buffer<span class="operator">.</span>close();
     <span class="comment">// byteArray == &quot;abcdef&quot;</span></pre>
<p><b>See also </b><a href="qbuffer.html#open">open</a>(), <a href="qbuffer.html#setBuffer">setBuffer</a>(), and <a href="qbuffer.html#setData">setData</a>().</p>
<!-- @@@QBuffer -->
<!-- $$$~QBuffer[overload1]$$$~QBuffer -->
<h3 class="fn"><a name="dtor.QBuffer"></a>QBuffer::<span class="name">~QBuffer</span> ()</h3>
<p>Destroys the buffer.</p>
<!-- @@@~QBuffer -->
<!-- $$$atEnd[overload1]$$$atEnd -->
<h3 class="fn"><a name="atEnd"></a><span class="type">bool</span> QBuffer::<span class="name">atEnd</span> () const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qiodevice.html#atEnd">QIODevice::atEnd</a>().</p>
<!-- @@@atEnd -->
<!-- $$$buffer[overload1]$$$buffer -->
<h3 class="fn"><a name="buffer"></a><span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; QBuffer::<span class="name">buffer</span> ()</h3>
<p>Returns a reference to the <a href="qbuffer.html">QBuffer</a>'s internal buffer. You can use it to modify the <a href="qbytearray.html">QByteArray</a> behind the <a href="qbuffer.html">QBuffer</a>'s back.</p>
<p><b>See also </b><a href="qbuffer.html#setBuffer">setBuffer</a>() and <a href="qbuffer.html#data">data</a>().</p>
<!-- @@@buffer -->
<!-- $$$buffer$$$buffer -->
<h3 class="fn"><a name="buffer-2"></a>const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; QBuffer::<span class="name">buffer</span> () const</h3>
<p>This is an overloaded function.</p>
<p>This is the same as <a href="qbuffer.html#data">data</a>().</p>
<!-- @@@buffer -->
<!-- $$$canReadLine[overload1]$$$canReadLine -->
<h3 class="fn"><a name="canReadLine"></a><span class="type">bool</span> QBuffer::<span class="name">canReadLine</span> () const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qiodevice.html#canReadLine">QIODevice::canReadLine</a>().</p>
<!-- @@@canReadLine -->
<!-- $$$close[overload1]$$$close -->
<h3 class="fn"><a name="close"></a><span class="type">void</span> QBuffer::<span class="name">close</span> ()<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qiodevice.html#close">QIODevice::close</a>().</p>
<!-- @@@close -->
<!-- $$$data[overload1]$$$data -->
<h3 class="fn"><a name="data"></a>const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; QBuffer::<span class="name">data</span> () const</h3>
<p>Returns the data contained in the buffer.</p>
<p>This is the same as <a href="qbuffer.html#buffer">buffer</a>().</p>
<p><b>See also </b><a href="qbuffer.html#setData">setData</a>() and <a href="qbuffer.html#setBuffer">setBuffer</a>().</p>
<!-- @@@data -->
<!-- $$$open[overload1]$$$openOpenMode -->
<h3 class="fn"><a name="open"></a><span class="type">bool</span> QBuffer::<span class="name">open</span> ( <span class="type"><a href="qiodevice.html#OpenModeFlag-enum">OpenMode</a></span> <i>flags</i> )<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qiodevice.html#open">QIODevice::open</a>().</p>
<!-- @@@open -->
<!-- $$$pos[overload1]$$$pos -->
<h3 class="fn"><a name="pos"></a><span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> QBuffer::<span class="name">pos</span> () const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qiodevice.html#pos">QIODevice::pos</a>().</p>
<!-- @@@pos -->
<!-- $$$readData[overload1]$$$readDatachar*qint64 -->
<h3 class="fn"><a name="readData"></a><span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> QBuffer::<span class="name">readData</span> ( <span class="type">char</span> * <i>data</i>, <span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> <i>len</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qiodevice.html#readData">QIODevice::readData</a>().</p>
<!-- @@@readData -->
<!-- $$$seek[overload1]$$$seekqint64 -->
<h3 class="fn"><a name="seek"></a><span class="type">bool</span> QBuffer::<span class="name">seek</span> ( <span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> <i>pos</i> )<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qiodevice.html#seek">QIODevice::seek</a>().</p>
<!-- @@@seek -->
<!-- $$$setBuffer[overload1]$$$setBufferQByteArray* -->
<h3 class="fn"><a name="setBuffer"></a><span class="type">void</span> QBuffer::<span class="name">setBuffer</span> ( <span class="type"><a href="qbytearray.html">QByteArray</a></span> * <i>byteArray</i> )</h3>
<p>Makes <a href="qbuffer.html">QBuffer</a> uses the <a href="qbytearray.html">QByteArray</a> pointed to by <i>byteArray</i> as its internal buffer. The caller is responsible for ensuring that <i>byteArray</i> remains valid until the <a href="qbuffer.html">QBuffer</a> is destroyed, or until setBuffer() is called to change the buffer. <a href="qbuffer.html">QBuffer</a> doesn't take ownership of the <a href="qbytearray.html">QByteArray</a>.</p>
<p>Does nothing if <a href="qiodevice.html#isOpen">isOpen</a>() is true.</p>
<p>If you open the buffer in write-only mode or read-write mode and write something into the <a href="qbuffer.html">QBuffer</a>, <i>byteArray</i> will be modified.</p>
<p>Example:</p>
<pre class="cpp">     <span class="type"><a href="qbytearray.html">QByteArray</a></span> byteArray(<span class="string">&quot;abc&quot;</span>);
     <span class="type"><a href="qbuffer.html">QBuffer</a></span> buffer;
     buffer<span class="operator">.</span>setBuffer(<span class="operator">&amp;</span>byteArray);
     buffer<span class="operator">.</span>open(<span class="type"><a href="qiodevice.html">QIODevice</a></span><span class="operator">::</span>WriteOnly);
     buffer<span class="operator">.</span>seek(<span class="number">3</span>);
     buffer<span class="operator">.</span>write(<span class="string">&quot;def&quot;</span><span class="operator">,</span> <span class="number">3</span>);
     buffer<span class="operator">.</span>close();
     <span class="comment">// byteArray == &quot;abcdef&quot;</span></pre>
<p>If <i>byteArray</i> is 0, the buffer creates its own internal <a href="qbytearray.html">QByteArray</a> to work on. This byte array is initially empty.</p>
<p><b>See also </b><a href="qbuffer.html#buffer">buffer</a>(), <a href="qbuffer.html#setData">setData</a>(), and <a href="qbuffer.html#open">open</a>().</p>
<!-- @@@setBuffer -->
<!-- $$$setData[overload1]$$$setDataconstQByteArray& -->
<h3 class="fn"><a name="setData"></a><span class="type">void</span> QBuffer::<span class="name">setData</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>data</i> )</h3>
<p>Sets the contents of the internal buffer to be <i>data</i>. This is the same as assigning <i>data</i> to <a href="qbuffer.html#buffer">buffer</a>().</p>
<p>Does nothing if <a href="qiodevice.html#isOpen">isOpen</a>() is true.</p>
<p><b>See also </b><a href="qbuffer.html#data">data</a>() and <a href="qbuffer.html#setBuffer">setBuffer</a>().</p>
<!-- @@@setData -->
<!-- $$$setData$$$setDataconstchar*int -->
<h3 class="fn"><a name="setData-2"></a><span class="type">void</span> QBuffer::<span class="name">setData</span> ( const <span class="type">char</span> * <i>data</i>, <span class="type">int</span> <i>size</i> )</h3>
<p>This is an overloaded function.</p>
<p>Sets the contents of the internal buffer to be the first <i>size</i> bytes of <i>data</i>.</p>
<!-- @@@setData -->
<!-- $$$size[overload1]$$$size -->
<h3 class="fn"><a name="size"></a><span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> QBuffer::<span class="name">size</span> () const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qiodevice.html#size">QIODevice::size</a>().</p>
<!-- @@@size -->
<!-- $$$writeData[overload1]$$$writeDataconstchar*qint64 -->
<h3 class="fn"><a name="writeData"></a><span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> QBuffer::<span class="name">writeData</span> ( const <span class="type">char</span> * <i>data</i>, <span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> <i>len</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qiodevice.html#writeData">QIODevice::writeData</a>().</p>
<!-- @@@writeData -->
</div>
  <div class="ft">
    <span></span>
  </div>
</div> 
<div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2012 Nokia Corporation and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Nokia, Qt and their respective logos are trademarks of Nokia Corporation 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>