complete-reference-vb_net_59
complete-reference-vb_net_59
The following example demonstrates the Current constant of the SeekOrigin enumeration. First it creates a
FileStream object with the file access option set to write. Then it creates a StreamWriter object to write the
data into the file (with full path) passed to the method's source parameter. The word to write to the file is
passed to the noiseword parameter.
The following method now reads the contents of the file into an array as follows:
BufferedStream
A buffered stream's purpose in life is to read and write to another stream. BufferedStream is essentially a
block of bytes in memory used to cache data, thereby reducing the number of calls to the operating system.
You will use your buffers to improve read and write performance, but you cannot use a buffer to read and
write at the same time. Objects of the BufferedStream work like the FileStream object, but the Read and
Write methods of BufferedStream are used to automatically maintain the buffer. I liken it to overdraft
protection for a stream.
543