complete-reference-vb_net_66
complete-reference-vb_net_66
BinaryReader/BinaryWriter
The BinaryReader and BinaryWriter classes read and write primitive data types as binary values in a
specific encoding. The primary methods in these classes are Read and Write, which come in a different
flavor for every data type supported in the framework.
XML I/O
The .NET XML namespaces remind me of the Amazon jungle. So vast, so thick, and so chock−full of
functionality that you need a dedicated platoon of experts to decipher themin a book dedicated to the subject
of .NET XML support. Still, two classes in the XML realm belong in our inner circle of I/O support because
they represent the fundamental ability to read and write: XMLTextReader and the XMLTextWriter.
The XmlTextReader object provides forward−only, read−only access to a stream of XML data. You can gain
programmatic access to the current node in the text by being able to reference the node on which the reader is
positioned. The reader advances through the data by being able to use any of the read methods and properties
to reflect the value of the current node.
The XmlTextReader class implements the abstract XmlReader, which has been designed to conform to
W3C Extensible Markup Language (XML) 1.0 and the Namespaces in XML recommendations.
XmlTextReader provides us with the functionality listed in Table 15−31.
The XmlTextReader class provides the parsing and tokenizing functionality we need to read XML files. The
XML Document Object Model (DOM) provides great flexibility for loading XML files as documents, but
there is still the need to read XML as a file−based stream and perform basic element manipulation. Since
loading XML via the services of the DOM does require some overhead, loading XML files through the
XmlTextReader is normally faster and more efficient.
550