What is the difference between all these classes such as StreamReader, BufferedStream, FileStream, M

F

foreman

Hi there,

Hello everybody. I am a newbie to dot net framework class lib. I
am confused about those classes such as all of the stream classes and
those XXXReader XXXWriter. In fact, I have tried the StreamReader(which
can read in big5 encoding text files well) and besides, I have tried
the BufferedStream to do the same thing. It does work fine except that
It can't interpret the Chinese big5 words well(which becomes messy code
around). But aside from those Chinese words, it still can print out the
same output as the StreamReader class does. My question is: Why are
there so many stream classes and xxxreader and xxxwriter classes with
the same functionality(just a little bit difference in between).
Hopefully I will receive your responses very soon.

best regards,

horngsh.
 
J

Jon Skeet [C# MVP]

foreman said:
Hello everybody. I am a newbie to dot net framework class lib. I
am confused about those classes such as all of the stream classes and
those XXXReader XXXWriter. In fact, I have tried the StreamReader(which
can read in big5 encoding text files well) and besides, I have tried
the BufferedStream to do the same thing. It does work fine except that
It can't interpret the Chinese big5 words well(which becomes messy code
around). But aside from those Chinese words, it still can print out the
same output as the StreamReader class does. My question is: Why are
there so many stream classes and xxxreader and xxxwriter classes with
the same functionality(just a little bit difference in between).
Hopefully I will receive your responses very soon.

Plain Stream classes deal with binary data. Readers and Writers deal
with character data. The reason there are so many different classes is
because they deal with different data sources/destinations.

For instance, MemoryStream holds all of its data in memory, whereas
FileStream deals with file-based data. Likewise StringReader creates a
reader from an existing string, StreamReader creates a reader from a
stream, etc.

What problem were you having with Big5 though?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top