Streams
When using streams, it is best to think of the different types of streams in an abstract sense. They are all a stream or a block of data that you can write to or read from. The medium that holds this data differentiates the different stream classes. Therefore, a FileStream hosts a block of data in a file; a MemoryStream hosts a block of data in memory. The methods by which you read from and write to a stream are the same. The following examples will use a FileStream; however, using a MemoryStream or NetworkStream will be, for the most part, identical.
Whereas the streaming classes encapsulate the block of data, one requires readers and writers to read from a stream and to write to a stream, respectively. For a text-based stream, these ...
Get Delphi for .NET Developer’s Guide 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.