]>
Commit | Line | Data |
---|---|---|
f3845e88 VZ |
1 | \section{\class{wxDataOutputStream}}\label{wxdataoutputstream} |
2 | ||
3 | This class provides functions that write binary data types in a | |
2edb0bde | 4 | portable way. Data can be written in either big-endian or little-endian |
f3845e88 VZ |
5 | format, little-endian being the default on all architectures. |
6 | ||
7 | If you want to write data to text files (or streams) use | |
8 | \helpref{wxTextOutputStream}{wxtextoutputstream} instead. | |
9 | ||
10 | The << operator is overloaded and you can use this class like a standard | |
11 | C++ iostream. See \helpref{wxDataInputStream}{wxdatainputstream} for its | |
12 | usage and caveats. | |
13 | ||
14 | See also \helpref{wxDataInputStream}{wxdatainputstream}. | |
15 | ||
16 | \wxheading{Derived from} | |
17 | ||
18 | None | |
19 | ||
0e10e38d VZ |
20 | \wxheading{Include files} |
21 | ||
22 | <wx/datstrm.h> | |
23 | ||
a7af285d VZ |
24 | \wxheading{Library} |
25 | ||
26 | \helpref{wxBase}{librarieslist} | |
27 | ||
f3845e88 VZ |
28 | \latexignore{\rtfignore{\wxheading{Members}}} |
29 | ||
f510b7b2 | 30 | \membersection{wxDataOutputStream::wxDataOutputStream}\label{wxdataoutputstreamctor} |
f3845e88 VZ |
31 | |
32 | \func{}{wxDataOutputStream}{\param{wxOutputStream\&}{ stream}} | |
33 | ||
f764e0ed | 34 | \func{}{wxDataOutputStream}{\param{wxOutputStream\&}{ stream}, \param{const wxMBConv\&}{ conv = wxConvAuto()}} |
a99acbb0 | 35 | |
f3845e88 | 36 | Constructs a datastream object from an output stream. Only write methods will |
fc2171bd | 37 | be available. The second form is only available in Unicode build of wxWidgets. |
f3845e88 VZ |
38 | |
39 | \wxheading{Parameters} | |
40 | ||
41 | \docparam{stream}{The output stream.} | |
42 | ||
a99acbb0 VS |
43 | \docparam{conv}{Charset conversion object object used to encoding Unicode |
44 | strings before writing them to the stream | |
45 | in Unicode mode (see \helpref{wxDataOutputStream::WriteString}{wxdataoutputstreamwritestring} | |
46 | documentation for detailed description). Note that you must not destroy | |
47 | {\it conv} before you destroy this wxDataOutputStream instance! It is | |
48 | recommended to use default value (UTF-8).} | |
49 | ||
f510b7b2 | 50 | \membersection{wxDataOutputStream::\destruct{wxDataOutputStream}}\label{wxdataoutputstreamdtor} |
f3845e88 VZ |
51 | |
52 | \func{}{\destruct{wxDataOutputStream}}{\void} | |
53 | ||
54 | Destroys the wxDataOutputStream object. | |
55 | ||
f510b7b2 | 56 | \membersection{wxDataOutputStream::BigEndianOrdered}\label{wxdataoutputstreambigendianorder} |
f3845e88 VZ |
57 | |
58 | \func{void}{BigEndianOrdered}{\param{bool}{ be\_order}} | |
59 | ||
cc81d32f | 60 | If {\it be\_order} is true, all data will be written in big-endian |
f3845e88 VZ |
61 | order, e.g. for reading on a Sparc or from Java-Streams (which |
62 | always use big-endian order), otherwise data will be written in | |
63 | little-endian order. | |
64 | ||
f510b7b2 | 65 | \membersection{wxDataOutputStream::Write8}\label{wxdataoutputstreamwrite8} |
f3845e88 VZ |
66 | |
67 | \func{void}{Write8}{{\param wxUint8 }{i8}} | |
68 | ||
69 | Writes the single byte {\it i8} to the stream. | |
70 | ||
53663be8 VZ |
71 | \func{void}{Write8}{\param{const wxUint8 *}{buffer}, \param{size\_t }{size}} |
72 | ||
73 | Writes an array of bytes to the stream. The amount of bytes to write is | |
74 | specified with the {\it size} variable. | |
75 | ||
f510b7b2 | 76 | \membersection{wxDataOutputStream::Write16}\label{wxdataoutputstreamwrite16} |
f3845e88 VZ |
77 | |
78 | \func{void}{Write16}{{\param wxUint16 }{i16}} | |
79 | ||
4d1cbdbe | 80 | Writes the 16 bit unsigned integer {\it i16} to the stream. |
f3845e88 | 81 | |
53663be8 VZ |
82 | \func{void}{Write16}{\param{const wxUint16 *}{buffer}, \param{size\_t }{size}} |
83 | ||
84 | Writes an array of 16 bit unsigned integer to the stream. The amount of | |
85 | 16 bit unsigned integer to write is specified with the {\it size} variable. | |
86 | ||
f510b7b2 | 87 | \membersection{wxDataOutputStream::Write32}\label{wxdataoutputstreamwrite32} |
f3845e88 VZ |
88 | |
89 | \func{void}{Write32}{{\param wxUint32 }{i32}} | |
90 | ||
4d1cbdbe VZ |
91 | Writes the 32 bit unsigned integer {\it i32} to the stream. |
92 | ||
53663be8 VZ |
93 | \func{void}{Write32}{\param{const wxUint32 *}{buffer}, \param{size\_t }{size}} |
94 | ||
95 | Writes an array of 32 bit unsigned integer to the stream. The amount of | |
96 | 32 bit unsigned integer to write is specified with the {\it size} variable. | |
97 | ||
f510b7b2 | 98 | \membersection{wxDataOutputStream::Write64}\label{wxdataoutputstreamwrite64} |
4d1cbdbe VZ |
99 | |
100 | \func{void}{Write64}{{\param wxUint64 }{i64}} | |
101 | ||
102 | Writes the 64 bit unsigned integer {\it i64} to the stream. | |
f3845e88 | 103 | |
53663be8 VZ |
104 | \func{void}{Write64}{\param{const wxUint64 *}{buffer}, \param{size\_t }{size}} |
105 | ||
106 | Writes an array of 64 bit unsigned integer to the stream. The amount of | |
107 | 64 bit unsigned integer to write is specified with the {\it size} variable. | |
108 | ||
f510b7b2 | 109 | \membersection{wxDataOutputStream::WriteDouble}\label{wxdataoutputstreamwritedouble} |
f3845e88 VZ |
110 | |
111 | \func{void}{WriteDouble}{{\param double }{f}} | |
112 | ||
113 | Writes the double {\it f} to the stream using the IEEE format. | |
114 | ||
53663be8 VZ |
115 | \func{void}{WriteDouble}{\param{const double *}{buffer}, \param{size\_t }{size}} |
116 | ||
117 | Writes an array of double to the stream. The amount of double to write is | |
118 | specified with the {\it size} variable. | |
119 | ||
a99acbb0 VS |
120 | \membersection{wxDataOutputStream::WriteString}\label{wxdataoutputstreamwritestring} |
121 | ||
122 | \func{void}{WriteString}{{\param const wxString\&}{string}} | |
f3845e88 | 123 | |
f3845e88 VZ |
124 | Writes {\it string} to the stream. Actually, this method writes the size of |
125 | the string before writing {\it string} itself. | |
126 | ||
fc2171bd | 127 | In ANSI build of wxWidgets, the string is written to the stream in exactly |
a99acbb0 VS |
128 | same way it is represented in memory. In Unicode build, however, the string |
129 | is first converted to multibyte representation with {\it conv} object passed | |
130 | to stream's constructor (consequently, ANSI application can read data | |
131 | written by Unicode application, as long as they agree on encoding) and this | |
132 | representation is written to the stream. UTF-8 is used by default. | |
ba637f22 | 133 |