-2

I have read a bunch of posts explaining what streams are and why they are needed. From what I understand a stream is a way of transferring binary data(1100110110111100) from one place to another. This brings me to my first questions:
Is this kinda like or exactly like a serial communication data transfer?
Are all streams just serial communication? Even Twitch.tv?

The classes that .NET provides take the binary data(1100010101011100110) and converts it to a usable format so that we can work with. Kind of like a translator or decipher-er or encoder (which ever term is the most accurate) For example, the StreamReader class converts the binary data of a stream to text.

I was a little confused when I saw that the StorageFile class had methods that could manipulate files without opening a stream, like CopyAsync and MoveAsync. In instances like these a stream is not needed because there is no translation from or to binary, just copying and deletion.

How much did I get right?

Uncle Ben
  • 333
  • 3
  • 12

1 Answers1

1

You do not need to think of the binary data transferred by binary streams as necessarily being of the form "(1100110110111100)". Binary streams could just as well be called "raw" streams. The point is not the binary nature of the data, it is the lack of any form of conversion. So, since everything is stored in binary, these streams just transfer it "as is", so, in binary. But you will hardly ever actually see any binary numbers while dealing with binary streams, because "binary" is not the point.

When using binary streams, data transfer happens in the worst case one byte at a time, more often one entire buffer at a time, almost never one bit at a time.

Serial communication is often abstracted as a binary stream, because we never really care about a single bit that arrived through the serial port: usually, enough bits are received to form an entire byte, and then this byte is viewed as arriving in from the binary stream that we have chosen to represent the serial port.

Copy and Move are convenience methods that usually use binary streams internally.

Mike Nakis
  • 56,297
  • 11
  • 110
  • 142