]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/datistrm.tex
changed wxImage::ComputeHistogram to use wxHashMap
[wxWidgets.git] / docs / latex / wx / datistrm.tex
CommitLineData
f6106dae
VZ
1\section{\class{wxDataInputStream}}\label{wxdatainputstream}
2
3This class provides functions that read binary data types in a
4portable way. Data can be read in either big-endian or litte-endian
5format, little-endian being the default on all architectures.
6
7If you want to read data from text files (or streams) use
8\helpref{wxTextInputStream}{wxtextinputstream} instead.
9
10The >> operator is overloaded and you can use this class like a standard C++ iostream.
11Note, however, that the arguments are the fixed size types wxUint32, wxInt32 etc
12and on a typical 32-bit computer, none of these match to the "long" type (wxInt32
13is defined as signed int on 32-bit architectures) so that you cannot use long. To avoid
14problems (here and elsewhere), make use of the wxInt32, wxUint32, etc types.
15
16For example:
17
18\begin{verbatim}
19 wxFileInputStream input( "mytext.dat" );
20 wxDataInputStream store( input );
21 wxUint8 i1;
22 float f2;
23 wxString line;
24
25 store >> i1; // read a 8 bit integer.
26 store >> i1 >> f2; // read a 8 bit integer followed by float.
27 store >> line; // read a text line
28\end{verbatim}
29
30See also \helpref{wxDataOutputStream}{wxdataoutputstream}.
31
32\wxheading{Derived from}
33
34None
35
36\wxheading{Include files}
37
38<wx/datstrm.h>
39
40\latexignore{\rtfignore{\wxheading{Members}}}
41
42\membersection{wxDataInputStream::wxDataInputStream}\label{wxdatainputstreamconstr}
43
44\func{}{wxDataInputStream}{\param{wxInputStream\&}{ stream}}
45
46Constructs a datastream object from an input stream. Only read methods will
47be available.
48
49\wxheading{Parameters}
50
51\docparam{stream}{The input stream.}
52
53\membersection{wxDataInputStream::\destruct{wxDataInputStream}}
54
55\func{}{\destruct{wxDataInputStream}}{\void}
56
57Destroys the wxDataInputStream object.
58
59\membersection{wxDataInputStream::BigEndianOrdered}
60
61\func{void}{BigEndianOrdered}{\param{bool}{ be\_order}}
62
63If {\it be\_order} is TRUE, all data will be read in big-endian
64order, such as written by programs on a big endian architecture
65(e.g. Sparc) or written by Java-Streams (which always use
66big-endian order).
67
68\membersection{wxDataInputStream::Read8}
69
70\func{wxUint8}{Read8}{\void}
71
72Reads a single byte from the stream.
73
74\membersection{wxDataInputStream::Read16}
75
76\func{wxUint16}{Read16}{\void}
77
78Reads a 16 bit integer from the stream.
79
80\membersection{wxDataInputStream::Read32}
81
82\func{wxUint32}{Read32}{\void}
83
84Reads a 32 bit integer from the stream.
85
86\membersection{wxDataInputStream::ReadDouble}
87
88\func{double}{ReadDouble}{\void}
89
90Reads a double (IEEE encoded) from the stream.
91
92\membersection{wxDataInputStream::ReadString}
93
94\func{wxString}{ReadString}{\void}
95
96Reads a string from a stream. Actually, this function first reads a long integer
97specifying the length of the string (without the last null character) and then
98reads the string.
99
100