STREAM
The Stream class defines properties and methods that derived stream classes must provide. These let the program perform relatively generic tasks with streams such as determining whether the stream allows writing.
The following table describes the Stream class’s most useful properties:
PROPERTY | PURPOSE |
CanRead | Returns True if the stream supports reading. |
CanSeek | Returns True if the stream supports seeking to a particular position in the stream. |
CanTimeout | Returns True if the stream supports timing out of read and write operations. |
CanWrite | Returns True if the stream supports writing. |
Length | Returns the number of bytes in the stream. |
Position | Returns the stream’s current position in its bytes. For a stream that supports seeking, the program can set this value to move to a particular position. |
ReadTimeout | Determines the number of milliseconds that a read operation will wait before timing out. |
WriteTimeout | Determines the number of milliseconds that a write operation will wait before timing out. |
The following table describes the Stream class’s most useful methods:
METHOD | PURPOSE |
BeginRead | Begins an asynchronous read. |
BeginWrite | Begins an asynchronous write. |
Close | Closes the stream and releases any resources it uses (such as file handles). |
EndRead | Waits for an asynchronous read to finish. |
EndWrite | Ends an asynchronous write. |
Flush | Flushes data from the stream’s buffers into the underlying storage medium (device, file, memory, and so forth). ... |
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.