471,355 Members | 1,585 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,355 software developers and data experts.

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

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.

Feb 19 '06 #1
1 4796
foreman <ho*****@gmail.com> wrote:
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?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Feb 19 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by waolly | last post: by
4 posts views Thread by Astronomically Confused | last post: by
3 posts views Thread by curt.bathras | last post: by
3 posts views Thread by Arpan | last post: by
3 posts views Thread by Tony Johansson | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.