1
\section{\class{wxDataOutputStream}}\label{wxdataoutputstream}
3
This class provides functions that write binary data types in a
4
portable way. Data can be written in either big-endian or little-endian
5
format, little-endian being the default on all architectures.
7
If you want to write data to text files (or streams) use
8
\helpref{wxTextOutputStream}{wxtextoutputstream} instead.
10
The << operator is overloaded and you can use this class like a standard
11
C++ iostream. See \helpref{wxDataInputStream}{wxdatainputstream} for its
14
See also \helpref{wxDataInputStream}{wxdatainputstream}.
16
\wxheading{Derived from}
20
\wxheading{Include files}
24
\latexignore{\rtfignore{\wxheading{Members}}}
26
\membersection{wxDataOutputStream::wxDataOutputStream}\label{wxdataoutputstreamctor}
28
\func{}{wxDataOutputStream}{\param{wxOutputStream\&}{ stream}}
30
\func{}{wxDataOutputStream}{\param{wxOutputStream\&}{ stream}, \param{wxMBConv\&}{ conv = wxMBConvUTF8}}
32
Constructs a datastream object from an output stream. Only write methods will
33
be available. The second form is only available in Unicode build of wxWidgets.
35
\wxheading{Parameters}
37
\docparam{stream}{The output stream.}
39
\docparam{conv}{Charset conversion object object used to encoding Unicode
40
strings before writing them to the stream
41
in Unicode mode (see \helpref{wxDataOutputStream::WriteString}{wxdataoutputstreamwritestring}
42
documentation for detailed description). Note that you must not destroy
43
{\it conv} before you destroy this wxDataOutputStream instance! It is
44
recommended to use default value (UTF-8).}
46
\membersection{wxDataOutputStream::\destruct{wxDataOutputStream}}\label{wxdataoutputstreamdtor}
48
\func{}{\destruct{wxDataOutputStream}}{\void}
50
Destroys the wxDataOutputStream object.
52
\membersection{wxDataOutputStream::BigEndianOrdered}\label{wxdataoutputstreambigendianorder}
54
\func{void}{BigEndianOrdered}{\param{bool}{ be\_order}}
56
If {\it be\_order} is true, all data will be written in big-endian
57
order, e.g. for reading on a Sparc or from Java-Streams (which
58
always use big-endian order), otherwise data will be written in
61
\membersection{wxDataOutputStream::Write8}\label{wxdataoutputstreamwrite8}
63
\func{void}{Write8}{{\param wxUint8 }{i8}}
65
Writes the single byte {\it i8} to the stream.
67
\func{void}{Write8}{\param{const wxUint8 *}{buffer}, \param{size\_t }{size}}
69
Writes an array of bytes to the stream. The amount of bytes to write is
70
specified with the {\it size} variable.
72
\membersection{wxDataOutputStream::Write16}\label{wxdataoutputstreamwrite16}
74
\func{void}{Write16}{{\param wxUint16 }{i16}}
76
Writes the 16 bit unsigned integer {\it i16} to the stream.
78
\func{void}{Write16}{\param{const wxUint16 *}{buffer}, \param{size\_t }{size}}
80
Writes an array of 16 bit unsigned integer to the stream. The amount of
81
16 bit unsigned integer to write is specified with the {\it size} variable.
83
\membersection{wxDataOutputStream::Write32}\label{wxdataoutputstreamwrite32}
85
\func{void}{Write32}{{\param wxUint32 }{i32}}
87
Writes the 32 bit unsigned integer {\it i32} to the stream.
89
\func{void}{Write32}{\param{const wxUint32 *}{buffer}, \param{size\_t }{size}}
91
Writes an array of 32 bit unsigned integer to the stream. The amount of
92
32 bit unsigned integer to write is specified with the {\it size} variable.
94
\membersection{wxDataOutputStream::Write64}\label{wxdataoutputstreamwrite64}
96
\func{void}{Write64}{{\param wxUint64 }{i64}}
98
Writes the 64 bit unsigned integer {\it i64} to the stream.
100
\func{void}{Write64}{\param{const wxUint64 *}{buffer}, \param{size\_t }{size}}
102
Writes an array of 64 bit unsigned integer to the stream. The amount of
103
64 bit unsigned integer to write is specified with the {\it size} variable.
105
\membersection{wxDataOutputStream::WriteDouble}\label{wxdataoutputstreamwritedouble}
107
\func{void}{WriteDouble}{{\param double }{f}}
109
Writes the double {\it f} to the stream using the IEEE format.
111
\func{void}{WriteDouble}{\param{const double *}{buffer}, \param{size\_t }{size}}
113
Writes an array of double to the stream. The amount of double to write is
114
specified with the {\it size} variable.
116
\membersection{wxDataOutputStream::WriteString}\label{wxdataoutputstreamwritestring}
118
\func{void}{WriteString}{{\param const wxString\&}{string}}
120
Writes {\it string} to the stream. Actually, this method writes the size of
121
the string before writing {\it string} itself.
123
In ANSI build of wxWidgets, the string is written to the stream in exactly
124
same way it is represented in memory. In Unicode build, however, the string
125
is first converted to multibyte representation with {\it conv} object passed
126
to stream's constructor (consequently, ANSI application can read data
127
written by Unicode application, as long as they agree on encoding) and this
128
representation is written to the stream. UTF-8 is used by default.