]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/datstrm.tex
documented SetMaxLength(0)
[wxWidgets.git] / docs / latex / wx / datstrm.tex
1 % ----------------------------------------------------------------------------
2 % wxDataInputStream
3 % ----------------------------------------------------------------------------
4 \section{\class{wxDataInputStream}}\label{wxdatainputstream}
5
6 This class provides functions that read binary data types in a
7 portable way. Data can be read in either big-endian or litte-endian
8 format, little-endian being the default on all architectures.
9
10 If you want to read data from text files (or streams) use
11 \helpref{wxTextInputStream}{wxtextinputstream} instead.
12
13 The >> operator is overloaded and you can use this class like a standard C++ iostream.
14 Note, however, that the arguments are the fixed size types wxUint32, wxInt32 etc
15 and on a typical 32-bit computer, none of these match to the "long" type (wxInt32
16 is defined as signed int on 32-bit architectures) so that you cannot use long. To avoid
17 problems (here and elsewhere), make use of the wxInt32, wxUint32, etc types.
18
19 For example:
20
21 \begin{verbatim}
22 wxFileInputStream input( "mytext.dat" );
23 wxDataInputStream store( input );
24 wxUint8 i1;
25 float f2;
26 wxString line;
27
28 store >> i1; // read a 8 bit integer.
29 store >> i1 >> f2; // read a 8 bit integer followed by float.
30 store >> line; // read a text line
31 \end{verbatim}
32
33 See also \helpref{wxDataOutputStream}{wxdataoutputstream}.
34
35 \wxheading{Derived from}
36
37 None
38
39 \wxheading{Include files}
40
41 <wx/datstrm.h>
42
43 \latexignore{\rtfignore{\wxheading{Members}}}
44
45 \membersection{wxDataInputStream::wxDataInputStream}\label{wxdatainputstreamconstr}
46
47 \func{}{wxDataInputStream}{\param{wxInputStream\&}{ stream}}
48
49 Constructs a datastream object from an input stream. Only read methods will
50 be available.
51
52 \wxheading{Parameters}
53
54 \docparam{stream}{The input stream.}
55
56 \membersection{wxDataInputStream::\destruct{wxDataInputStream}}
57
58 \func{}{\destruct{wxDataInputStream}}{\void}
59
60 Destroys the wxDataInputStream object.
61
62 \membersection{wxDataInputStream::BigEndianOrdered}
63
64 \func{void}{BigEndianOrdered}{\param{bool}{ be\_order}}
65
66 If {\it be\_order} is TRUE, all data will be read in big-endian
67 order, such as written by programs on a big endian architecture
68 (e.g. Sparc) or written by Java-Streams (which always use
69 big-endian order).
70
71 \membersection{wxDataInputStream::Read8}
72
73 \func{wxUint8}{Read8}{\void}
74
75 Reads a single byte from the stream.
76
77 \membersection{wxDataInputStream::Read16}
78
79 \func{wxUint16}{Read16}{\void}
80
81 Reads a 16 bit integer from the stream.
82
83 \membersection{wxDataInputStream::Read32}
84
85 \func{wxUint32}{Read32}{\void}
86
87 Reads a 32 bit integer from the stream.
88
89 \membersection{wxDataInputStream::ReadDouble}
90
91 \func{double}{ReadDouble}{\void}
92
93 Reads a double (IEEE encoded) from the stream.
94
95 \membersection{wxDataInputStream::ReadString}
96
97 \func{wxString}{ReadString}{\void}
98
99 Reads a string from a stream. Actually, this function first reads a long integer
100 specifying the length of the string (without the last null character) and then
101 reads the string.
102
103 % ----------------------------------------------------------------------------
104 % wxDataOutputStream
105 % ----------------------------------------------------------------------------
106
107 \section{\class{wxDataOutputStream}}\label{wxdataoutputstream}
108
109 This class provides functions that write binary data types in a
110 portable way. Data can be written in either big-endian or litte-endian
111 format, little-endian being the default on all architectures.
112
113 If you want to write data to text files (or streams) use
114 \helpref{wxTextOutputStream}{wxtextoutputstream} instead.
115
116 The << operator is overloaded and you can use this class like a standard
117 C++ iostream. See \helpref{wxDataInputStream}{wxdatainputstream} for its
118 usage and caveats.
119
120 See also \helpref{wxDataInputStream}{wxdatainputstream}.
121
122 \wxheading{Derived from}
123
124 None
125
126 \latexignore{\rtfignore{\wxheading{Members}}}
127
128 \membersection{wxDataOutputStream::wxDataOutputStream}\label{wxdataoutputstreamconstr}
129
130 \func{}{wxDataOutputStream}{\param{wxOutputStream\&}{ stream}}
131
132 Constructs a datastream object from an output stream. Only write methods will
133 be available.
134
135 \wxheading{Parameters}
136
137 \docparam{stream}{The output stream.}
138
139 \membersection{wxDataOutputStream::\destruct{wxDataOutputStream}}
140
141 \func{}{\destruct{wxDataOutputStream}}{\void}
142
143 Destroys the wxDataOutputStream object.
144
145 \membersection{wxDataOutputStream::BigEndianOrdered}
146
147 \func{void}{BigEndianOrdered}{\param{bool}{ be\_order}}
148
149 If {\it be\_order} is TRUE, all data will be written in big-endian
150 order, e.g. for reading on a Sparc or from Java-Streams (which
151 always use big-endian order), otherwise data will be written in
152 little-endian order.
153
154 \membersection{wxDataOutputStream::Write8}
155
156 \func{void}{Write8}{{\param wxUint8 }{i8}}
157
158 Writes the single byte {\it i8} to the stream.
159
160 \membersection{wxDataOutputStream::Write16}
161
162 \func{void}{Write16}{{\param wxUint16 }{i16}}
163
164 Writes the 16 bit integer {\it i16} to the stream.
165
166 \membersection{wxDataOutputStream::Write32}
167
168 \func{void}{Write32}{{\param wxUint32 }{i32}}
169
170 Writes the 32 bit integer {\it i32} to the stream.
171
172 \membersection{wxDataOutputStream::WriteDouble}
173
174 \func{void}{WriteDouble}{{\param double }{f}}
175
176 Writes the double {\it f} to the stream using the IEEE format.
177
178 \membersection{wxDataOutputStream::WriteString}
179
180 \func{void}{WriteString}{{\param const wxString\& }{string}}
181
182 Writes {\it string} to the stream. Actually, this method writes the size of
183 the string before writing {\it string} itself.
184