473,399 Members | 4,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 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 4907
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: waolly | last post by:
I have a function which gets passed a streamreader object as an argument (I know this might sound a little weird, but it's to avoid code repetition). My problem is this - given a streamreader...
1
by: Niels Johansen | last post by:
Hello, When using the asynchronous read method in the BufferedStream class, , it seems to me that it blocks like the normal synchronous read method. Why is it so? Why does the...
4
by: Astronomically Confused | last post by:
using System; using System.Collections; using System.IO; using System.Net; using System.Net.Sockets; using System.Threading; class HttpProcessor { private Socket s;
1
by: foreman | last post by:
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...
3
by: curt.bathras | last post by:
I am trying to open and read a file using the following: BufferedStream stream = new BufferedStream(File.OpenRead(aFilename)); If the file specified by aFilename is being used by another...
3
by: Arpan | last post by:
A file can be read using only the StreamReader object like this: Dim sReader As StreamReader sReader = New StreamReader(Server.MapPath("File1.txt")) While(sReader.Peek -1)...
1
by: AMP | last post by:
Hello, I am trying to see if a FileStream Opened using an"if" clause: FileStream infile = new FileStream("c:\\blink2.txt", FileMode.Open, FileAccess.Read, FileShare.Read); if (infile==0)..... ...
10
by: giddy | last post by:
hi , I' know what the StructLayoutAttribute does. I've seen it being used. But what does the Pack field do!? This is what MSDN says: Controls the alignment of data fields of a class or...
3
by: Tony Johansson | last post by:
Hello! I just wonder in this specific case is it any advantage to use a TextReader a reference to a StreamReader ? Try { TextReader tr = new StreamReader(locationTextBox.Text); Try {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.