What is the difference between all these classes such as StreamReader, BufferedStream, FileStream, MemoryStream?
-
StreamReader: reads a Stream FileStream: represents a stream that can be read from a file MemoyStream: a stream that exists in memory ...
I think it is all in MSDN StreamReader FileStream MemoryStream BufferedStream
So, you can use a StreamReader to read a FileStream, or a MemoryStream, etc...
-
We can start by lifting out
StreamReader: this one is a class that is used for reading from various streams (such as aMemoryStreamorFileStream), but it is not aStreamitself.The other ones are simply different implementations of the abstract
Streamclass, representing data streams with different storage mechanisms;MemoryStreamrepresents data held in memory,FileStreamrepresents data held in a file on disk.Some
Streamimplementation are "wrapped" around other streams in order to provide added functionality (such as theGZipStreamandBufferedStream).For more detailed information about the different streams, check out their MSDN documentation. You can find a list of
Streamclass implementations in the .NET Framework towards the end of the page of theStreamclass documentation. -
Best idea will be to read msdn documentation.
StreamReader Class: Implements a TextReader that reads characters from a byte stream in a particular encoding.
BufferedStream Class: Adds a buffering layer to read and write operations on another stream. This class cannot be inherited.
FileStream Class: Exposes a Stream around a file, supporting both synchronous and asynchronous read and write operations.
MemoryStream Class: Creates a stream whose backing store is memory.
0 comments:
Post a Comment