1 % ----------------------------------------------------------------------------
3 % ----------------------------------------------------------------------------
4 \section{\class{wxDataInputStream
}}\label{wxdatainputstream
}
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.
10 If you want to read data from text files (or streams) use
11 \helpref{wxTextInputStream
}{wxtextinputstream
} instead.
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.
21 wxFileInputStream input( "mytext.dat" );
22 wxDataInputStream store( input );
27 store >> i1; // read a
8 bit integer.
28 store >> i1 >> f2; // read a
8 bit integer followed by float.
29 store >> line; // read a text line
32 See also
\helpref{wxDataOutputStream
}{wxdataoutputstream
}.
34 \wxheading{Derived from
}
38 \wxheading{Include files
}
42 \latexignore{\rtfignore{\wxheading{Members
}}}
44 \membersection{wxDataInputStream::wxDataInputStream
}\label{wxdatainputstreamconstr
}
46 \func{}{wxDataInputStream
}{\param{wxInputStream\&
}{ stream
}}
48 Constructs a datastream object from an input stream. Only read methods will
51 \wxheading{Parameters
}
53 \docparam{stream
}{The input stream.
}
55 \membersection{wxDataInputStream::
\destruct{wxDataInputStream
}}
57 \func{}{\destruct{wxDataInputStream
}}{\void}
59 Destroys the wxDataInputStream object.
61 \membersection{wxDataInputStream::BigEndianOrdered
}
63 \func{void
}{BigEndianOrdered
}{\param{bool
}{ be_order
}}
65 If
{\it be_order
} is TRUE, all data will be read in big-endian
66 order, such as written by programs on a big endian architecture
67 (e.g. Sparc) or written by Java-Streams (which always use
70 \membersection{wxDataInputStream::Read8
}
72 \func{wxUint8
}{Read8
}{\void}
74 Reads a single byte from the stream.
76 \membersection{wxDataInputStream::Read16
}
78 \func{wxUint16
}{Read16
}{\void}
80 Reads a
16 bit integer from the stream.
82 \membersection{wxDataInputStream::Read32
}
84 \func{wxUint32
}{Read32
}{\void}
86 Reads a
32 bit integer from the stream.
88 \membersection{wxDataInputStream::ReadDouble
}
90 \func{double
}{ReadDouble
}{\void}
92 Reads a double (IEEE encoded) from the stream.
94 \membersection{wxDataInputStream::ReadString
}
96 \func{wxString
}{wxDataInputStream::ReadString
}{\void}
98 Reads a string from a stream. Actually, this function first reads a long integer
99 specifying the length of the string (without the last null character) and then
102 % ----------------------------------------------------------------------------
104 % ----------------------------------------------------------------------------
106 \section{\class{wxDataOutputStream
}}\label{wxdataoutputstream
}
108 This class provides functions that write binary data types in a
109 portable way. Data can be written in either big-endian or litte-endian
110 format, little-endian being the default on all architectures.
112 If you want to write data to text files (or streams) use
113 \helpref{wxTextOutputStream
}{wxtextoutputstream
} instead.
115 The << operator is overloaded and you can use this class like a standard
116 C++ iostream. See
\helpref{wxDataInputStream
}{wxdatainputstream
} for its
119 See also
\helpref{wxDataInputStream
}{wxdatainputstream
}.
121 \wxheading{Derived from
}
125 \latexignore{\rtfignore{\wxheading{Members
}}}
127 \membersection{wxDataOutputStream::wxDataOutputStream
}\label{wxdataoutputstreamconstr
}
129 \func{}{wxDataOutputStream
}{\param{wxOutputStream\&
}{ stream
}}
131 Constructs a datastream object from an output stream. Only write methods will
134 \wxheading{Parameters
}
136 \docparam{stream
}{The output stream.
}
138 \membersection{wxDataOutputStream::
\destruct{wxDataOutputStream
}}
140 \func{}{\destruct{wxDataOutputStream
}}{\void}
142 Destroys the wxDataOutputStream object.
144 \membersection{wxDataOutputStream::BigEndianOrdered
}
146 \func{void
}{BigEndianOrdered
}{\param{bool
}{ be_order
}}
148 If
{\it be_order
} is TRUE, all data will be written in big-endian
149 order, e.g. for reading on a Sparc or from Java-Streams (which
150 always use big-endian order), otherwise data will be written in
153 \membersection{wxDataOutputStream::Write8
}
155 \func{void
}{wxDataOutputStream::Write8
}{{\param wxUint8
}{i8
}}
157 Writes the single byte
{\it i8
} to the stream.
159 \membersection{wxDataOutputStream::Write16
}
161 \func{void
}{wxDataOutputStream::Write16
}{{\param wxUint16
}{i16
}}
163 Writes the
16 bit integer
{\it i16
} to the stream.
165 \membersection{wxDataOutputStream::Write32
}
167 \func{void
}{wxDataOutputStream::Write32
}{{\param wxUint32
}{i32
}}
169 Writes the
32 bit integer
{\it i32
} to the stream.
171 \membersection{wxDataOutputStream::WriteDouble
}
173 \func{void
}{wxDataOutputStream::WriteDouble
}{{\param double
}{f
}}
175 Writes the double
{\it f
} to the stream using the IEEE format.
177 \membersection{wxDataOutputStream::WriteString
}
179 \func{void
}{wxDataOutputStream::WriteString
}{{\param const wxString\&
}{string
}}
181 Writes
{\it string
} to the stream. Actually, this method writes the size of
182 the string before writing
{\it string
} itself.