File: Poco.BinaryWriter.html

package info (click to toggle)
poco-doc 1.3.6-1.1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 10,080 kB
  • sloc: makefile: 31
file content (204 lines) | stat: -rw-r--r-- 13,589 bytes parent folder | download | duplicates (3)
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Class Poco::BinaryWriter</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-24"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<h1 class="namespace"><a href="Poco.html" class="namespace">Poco</a></h1>
<h1 class="symbol">class BinaryWriter</h1>
</div>
<div class="body">
<p>
<b>Library:</b> Foundation<br />
<b>Package:</b> Streams<br />
<b>Header:</b> Poco/BinaryWriter.h</p>
<h2>Description</h2>
<div class="description">
<p>This class writes basic types in binary form into an output stream. It provides an inserter-based interface similar to ostream. The writer also supports automatic conversion from big-endian (network byte order) to little-endian and vice-versa. Use a <a href="Poco.BinaryReader.html" title="class Poco::BinaryReader">BinaryReader</a> to read from a stream created by a <a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a>. Be careful when exchanging data between systems with different data type sizes (e.g., 32-bit and 64-bit architectures), as the sizes of some of the basic types may be different. For example, writing a long integer on a 64-bit system and reading it on a 32-bit system may yield an incorrent result. Use fixed-size types (<a href="Poco.html#11353" title="Poco::Int32">Int32</a>, <a href="Poco.html#11357" title="Poco::Int64">Int64</a>, etc.) in such a case. </p>
</div>
<h2>Member Summary</h2>
<p><b>Member Functions: </b><a href="Poco.BinaryWriter.html#3923" title="Poco::BinaryWriter::bad()">bad</a>, <a href="Poco.BinaryWriter.html#3925" title="Poco::BinaryWriter::byteOrder()">byteOrder</a>, <a href="Poco.BinaryWriter.html#3922" title="Poco::BinaryWriter::fail()">fail</a>, <a href="Poco.BinaryWriter.html#3920" title="Poco::BinaryWriter::flush()">flush</a>, <a href="Poco.BinaryWriter.html#3921" title="Poco::BinaryWriter::good()">good</a>, <a href="Poco.BinaryWriter.html#3878" title="Poco::BinaryWriter::operator <<()">operator&nbsp;&lt;&lt;</a>, <a href="Poco.BinaryWriter.html#3924" title="Poco::BinaryWriter::stream()">stream</a>, <a href="Poco.BinaryWriter.html#3910" title="Poco::BinaryWriter::write7BitEncoded()">write7BitEncoded</a>, <a href="Poco.BinaryWriter.html#3919" title="Poco::BinaryWriter::writeBOM()">writeBOM</a>, <a href="Poco.BinaryWriter.html#3914" title="Poco::BinaryWriter::writeRaw()">writeRaw</a></p>
<h2>Enumerations</h2>
<h3><a name="3869">StreamByteOrder</a></h3>
<div class="description">
<p></p>
</div>
<p class="decl"><a name="3870">NATIVE_BYTE_ORDER</a> = 1</p>
<div class="description">
<p>the host's native byte-order </p>
</div>
<p class="decl"><a name="3871">BIG_ENDIAN_BYTE_ORDER</a> = 2</p>
<div class="description">
<p>big-endian (network) byte-order </p>
</div>
<p class="decl"><a name="3872">NETWORK_BYTE_ORDER</a> = 2</p>
<div class="description">
<p>big-endian (network) byte-order </p>
</div>
<p class="decl"><a name="3873">LITTLE_ENDIAN_BYTE_ORDER</a> = 3</p>
<div class="description">
<p>little-endian byte-order </p>
</div>
<h2>Constructors</h2>
<h3><a name="3874">BinaryWriter</a></h3>
<p class="decl"><a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a>(<br />&nbsp;&nbsp;&nbsp;&nbsp;std::ostream &amp; ostr,<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href="Poco.BinaryWriter.html#3869" title="enum  Poco::BinaryWriter::StreamByteOrder">StreamByteOrder</a> byteOrder = NATIVE_BYTE_ORDER<br />);</p>
<div class="description">
<p>Creates the <a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a>. </p>
</div>
<h2>Destructor</h2>
<h3><a name="3877">~BinaryWriter</a></h3>
<p class="decl">~<a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a>();</p>
<div class="description">
<p>Destroys the <a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a>. </p>
</div>
<h2>Member Functions</h2>
<h3><a name="3923">bad</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool bad();</p>
<div class="description">
<p>Returns _ostr.<a href="Poco.BinaryWriter.html#3923" title="Poco::BinaryWriter::bad()">bad</a>(); </p>
</div>
<h3><a name="3925">byteOrder</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.BinaryWriter.html#3869" title="enum  Poco::BinaryWriter::StreamByteOrder">StreamByteOrder</a> byteOrder() const;</p>
<div class="description">
<p>Returns the byte ordering used by the writer, which is either <a href="Poco.BinaryWriter.html#3871" title="Poco::BinaryWriter::BIG_ENDIAN_BYTE_ORDER">BIG_ENDIAN_BYTE_ORDER</a> or <a href="Poco.BinaryWriter.html#3873" title="Poco::BinaryWriter::LITTLE_ENDIAN_BYTE_ORDER">LITTLE_ENDIAN_BYTE_ORDER</a>. </p>
</div>
<h3><a name="3922">fail</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool fail();</p>
<div class="description">
<p>Returns _ostr.<a href="Poco.BinaryWriter.html#3922" title="Poco::BinaryWriter::fail()">fail</a>(); </p>
</div>
<h3><a name="3920">flush</a></h3>
<p class="decl">void flush();</p>
<div class="description">
<p>Flushes the underlying stream. </p>
</div>
<h3><a name="3921">good</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool good();</p>
<div class="description">
<p>Returns _ostr.<a href="Poco.BinaryWriter.html#3921" title="Poco::BinaryWriter::good()">good</a>(); </p>
</div>
<h3><a name="3878">operator &lt;&lt;</a></h3>
<p class="decl"><a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a> &amp; operator &lt;&lt; (<br />&nbsp;&nbsp;&nbsp;&nbsp;bool value<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="3880">operator &lt;&lt;</a></h3>
<p class="decl"><a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a> &amp; operator &lt;&lt; (<br />&nbsp;&nbsp;&nbsp;&nbsp;char value<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="3882">operator &lt;&lt;</a></h3>
<p class="decl"><a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a> &amp; operator &lt;&lt; (<br />&nbsp;&nbsp;&nbsp;&nbsp;unsigned char value<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="3884">operator &lt;&lt;</a></h3>
<p class="decl"><a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a> &amp; operator &lt;&lt; (<br />&nbsp;&nbsp;&nbsp;&nbsp;signed char value<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="3886">operator &lt;&lt;</a></h3>
<p class="decl"><a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a> &amp; operator &lt;&lt; (<br />&nbsp;&nbsp;&nbsp;&nbsp;short value<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="3888">operator &lt;&lt;</a></h3>
<p class="decl"><a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a> &amp; operator &lt;&lt; (<br />&nbsp;&nbsp;&nbsp;&nbsp;unsigned short value<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="3890">operator &lt;&lt;</a></h3>
<p class="decl"><a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a> &amp; operator &lt;&lt; (<br />&nbsp;&nbsp;&nbsp;&nbsp;int value<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="3892">operator &lt;&lt;</a></h3>
<p class="decl"><a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a> &amp; operator &lt;&lt; (<br />&nbsp;&nbsp;&nbsp;&nbsp;unsigned int value<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="3894">operator &lt;&lt;</a></h3>
<p class="decl"><a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a> &amp; operator &lt;&lt; (<br />&nbsp;&nbsp;&nbsp;&nbsp;long value<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="3896">operator &lt;&lt;</a></h3>
<p class="decl"><a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a> &amp; operator &lt;&lt; (<br />&nbsp;&nbsp;&nbsp;&nbsp;unsigned long value<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="3898">operator &lt;&lt;</a></h3>
<p class="decl"><a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a> &amp; operator &lt;&lt; (<br />&nbsp;&nbsp;&nbsp;&nbsp;float value<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="3900">operator &lt;&lt;</a></h3>
<p class="decl"><a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a> &amp; operator &lt;&lt; (<br />&nbsp;&nbsp;&nbsp;&nbsp;double value<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="3902">operator &lt;&lt;</a></h3>
<p class="decl"><a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a> &amp; operator &lt;&lt; (<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href="Poco.html#11357" title="Poco::Int64">Int64</a> value<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="3904">operator &lt;&lt;</a></h3>
<p class="decl"><a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a> &amp; operator &lt;&lt; (<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href="Poco.html#11358" title="Poco::UInt64">UInt64</a> value<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="3906">operator &lt;&lt;</a></h3>
<p class="decl"><a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a> &amp; operator &lt;&lt; (<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; value<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="3908">operator &lt;&lt;</a></h3>
<p class="decl"><a href="Poco.BinaryWriter.html" title="class Poco::BinaryWriter">BinaryWriter</a> &amp; operator &lt;&lt; (<br />&nbsp;&nbsp;&nbsp;&nbsp;const char * value<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="3924">stream</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">std::ostream &amp; stream() const;</p>
<div class="description">
<p>Returns the underlying stream. </p>
</div>
<h3><a name="3910">write7BitEncoded</a></h3>
<p class="decl">void write7BitEncoded(<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href="Poco.html#11354" title="Poco::UInt32">UInt32</a> value<br />);</p>
<div class="description">
<p>Writes a 32-bit unsigned integer in a compressed format. The value is written out seven bits at a time, starting  with the seven least-significant bits.  The high bit of a byte indicates whether there are more bytes to be  written after this one. If value will fit in seven bits, it takes only one byte of space.  If value will not fit in seven bits, the high bit is set on the first byte and  written out. value is then shifted by seven bits and the next byte is written.  This process is repeated until the entire integer has been written. </p>
</div>
<h3><a name="3912">write7BitEncoded</a></h3>
<p class="decl">void write7BitEncoded(<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href="Poco.html#11358" title="Poco::UInt64">UInt64</a> value<br />);</p>
<div class="description">
<p>Writes a 64-bit unsigned integer in a compressed format. The value written out seven bits at a time, starting  with the seven least-significant bits.  The high bit of a byte indicates whether there are more bytes to be  written after this one. If value will fit in seven bits, it takes only one byte of space.  If value will not fit in seven bits, the high bit is set on the first byte and  written out. value is then shifted by seven bits and the next byte is written.  This process is repeated until the entire integer has been written. </p>
</div>
<h3><a name="3919">writeBOM</a></h3>
<p class="decl">void writeBOM();</p>
<div class="description">
<p>Writes a byte-order mark to the stream. A byte order mark is a 16-bit integer with a value of 0xFEFF, written in host byte-order.  A <a href="Poco.BinaryReader.html" title="class Poco::BinaryReader">BinaryReader</a> uses the byte-order mark to determine the byte-order  of the stream. </p>
</div>
<h3><a name="3914">writeRaw</a></h3>
<p class="decl">void writeRaw(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; rawData<br />);</p>
<div class="description">
<p>Writes the string as-is to the stream. </p>
</div>
<h3><a name="3916">writeRaw</a></h3>
<p class="decl">void writeRaw(<br />&nbsp;&nbsp;&nbsp;&nbsp;const char * buffer,<br />&nbsp;&nbsp;&nbsp;&nbsp;std::streamsize length<br />);</p>
<div class="description">
<p>Writes length raw bytes from the given buffer to the stream. </p>
</div>
<p class="footer">POCO C++ Libraries 1.3.6-all<br />
Copyright &copy; 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p>

</div>
</body>
</html>