1 \section{\class{wxDataInputStream
}}\label{wxdatainputstream
}
3 This class provides functions that read binary data types in a
4 portable way. Data can be read in either big-endian or litte-endian
5 format, little-endian being the default on all architectures.
7 If you want to read data from text files (or streams) use
8 \helpref{wxTextInputStream
}{wxtextinputstream
} instead.
10 The >> operator is overloaded and you can use this class like a standard C++ iostream.
11 Note, however, that the arguments are the fixed size types wxUint32, wxInt32 etc
12 and on a typical
32-bit computer, none of these match to the "long" type (wxInt32
13 is defined as signed int on
32-bit architectures) so that you cannot use long. To avoid
14 problems (here and elsewhere), make use of the wxInt32, wxUint32, etc types.
19 wxFileInputStream input( "mytext.dat" );
20 wxDataInputStream store( input );
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
30 See also
\helpref{wxDataOutputStream
}{wxdataoutputstream
}.
32 \wxheading{Derived from
}
36 \wxheading{Include files
}
40 \latexignore{\rtfignore{\wxheading{Members
}}}
42 \membersection{wxDataInputStream::wxDataInputStream
}\label{wxdatainputstreamconstr
}
44 \func{}{wxDataInputStream
}{\param{wxInputStream\&
}{ stream
}}
46 Constructs a datastream object from an input stream. Only read methods will
49 \wxheading{Parameters
}
51 \docparam{stream
}{The input stream.
}
53 \membersection{wxDataInputStream::
\destruct{wxDataInputStream
}}
55 \func{}{\destruct{wxDataInputStream
}}{\void}
57 Destroys the wxDataInputStream object.
59 \membersection{wxDataInputStream::BigEndianOrdered
}
61 \func{void
}{BigEndianOrdered
}{\param{bool
}{ be
\_order}}
63 If
{\it be
\_order} is TRUE, all data will be read in big-endian
64 order, such as written by programs on a big endian architecture
65 (e.g. Sparc) or written by Java-Streams (which always use
68 \membersection{wxDataInputStream::Read8
}
70 \func{wxUint8
}{Read8
}{\void}
72 Reads a single byte from the stream.
74 \membersection{wxDataInputStream::Read16
}
76 \func{wxUint16
}{Read16
}{\void}
78 Reads a
16 bit integer from the stream.
80 \membersection{wxDataInputStream::Read32
}
82 \func{wxUint32
}{Read32
}{\void}
84 Reads a
32 bit integer from the stream.
86 \membersection{wxDataInputStream::ReadDouble
}
88 \func{double
}{ReadDouble
}{\void}
90 Reads a double (IEEE encoded) from the stream.
92 \membersection{wxDataInputStream::ReadString
}
94 \func{wxString
}{ReadString
}{\void}
96 Reads a string from a stream. Actually, this function first reads a long integer
97 specifying the length of the string (without the last null character) and then