CUSTOM STREAM CLASSES

Visual Studio provides a few other stream classes with more specialized uses.

The CryptoStream class applies a cryptographic transformation to data that passes through it. For example, if you attach a CryptoStream to a file using a particular cryptographic transformation and then use it to write data, the CryptoStream automatically transforms the data and produces an encrypted file. Similarly, you can use a CryptoStream to read an encrypted file and recover the original text. For more information about the CryptoStream class, see http://msdn.microsoft.com/library/system.security.cryptography.cryptostream.aspx.

The NetworkStream class represents a socket-based stream over a network connection. You can use this class to make different applications communicate over a network. For more information about this class, see http://msdn.microsoft.com/library/system.net.sockets.networkstream.aspx.

Three other special uses of streams are standard input, standard output, and standard error. Console applications define these streams for reading and writing information to and from the console. An application can interact directly with these streams by accessing the Console.In, Console.Out, and Console.Error properties. It can change these streams to new stream objects such as StreamReaders and StreamWriters by calling the Console.SetIn, Console.SetOut, and Console.SetError methods. For more information on these streams, see http://msdn.microsoft.com/library/system.console.aspx ...

Get Visual Basic 2012 Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.