Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 138189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:13:29+00:00 2026-05-11T07:13:29+00:00

I understand that a stream is a representation of a sequence of bytes. Each

  • 0

I understand that a stream is a representation of a sequence of bytes. Each stream provides means for reading and writing bytes to its given backing store. But what is the point of the stream? Why isn’t the backing store itself what we interact with?

For whatever reason this concept just isn’t clicking for me. I’ve read a bunch of articles, but I think I need an analogy or something.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T07:13:30+00:00Added an answer on May 11, 2026 at 7:13 am

    The word ‘stream’ has been chosen because it represents (in real life) a very similar meaning to what we want to convey when we use it.

    Let’s forget about the backing store for a little, and start thinking about the analogy to a water stream. You receive a continuous flow of data, just like water continuously flows in a river. You don’t necessarily know where the data is coming from, and most often you don’t need to; be it from a file, a socket, or any other source, it doesn’t (shouldn’t) really matter. This is very similar to receiving a stream of water, whereby you don’t need to know where it is coming from; be it from a lake, a fountain, or any other source, it doesn’t (shouldn’t) really matter.

    That said, once you start thinking that you only care about getting the data you need, regardless of where it comes from, the abstractions other people talked about become clearer. You start thinking that you can wrap streams, and your methods will still work perfectly. For example, you could do this:

    int ReadInt(StreamReader reader) { return Int32.Parse(reader.ReadLine()); }  // in another method: Stream fileStream = new FileStream('My Data.dat'); Stream zipStream = new ZipDecompressorStream(fileStream); Stream decryptedStream = new DecryptionStream(zipStream); StreamReader reader = new StreamReader(decryptedStream);  int x = ReadInt(reader); 

    As you see, it becomes very easy to change your input source without changing your processing logic. For example, to read your data from a network socket instead of a file:

    Stream stream = new NetworkStream(mySocket); StreamReader reader = new StreamReader(stream); int x = ReadInt(reader); 

    As easy as it can be. And the beauty continues, as you can use any kind of input source, as long as you can build a stream ‘wrapper’ for it. You could even do this:

    public class RandomNumbersStreamReader : StreamReader {     private Random random = new Random();      public String ReadLine() { return random.Next().ToString(); } }  // and to call it: int x = ReadInt(new RandomNumbersStreamReader()); 

    See? As long as your method doesn’t care what the input source is, you can customize your source in various ways. The abstraction allows you to decouple input from processing logic in a very elegant way.

    Note that the stream we created ourselves does not have a backing store, but it still serves our purposes perfectly.

    So, to summarize, a stream is just a source of input, hiding away (abstracting) another source. As long as you don’t break the abstraction, your code will be very flexible.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand that CoCreateInstance finds the COM server for the given class id, creates
Hi all I understand that if we read bytes from an InputStream and we
I understand that you can use ffmpeg to serve a sequence of images as
I'm writing a program using Java non-blocking socket and TCP. I understand that TCP
I understand that byte streams deal with bytes and character streams deal with characters...
I understand that each packet has some header that seems like a random mix
I understand that Web Site Projects compile source on-the-fly, and Web Application Projects pre-compile
I understand that in MVVM: the View knows about the ViewModel the ViewModel knows
I understand that we need to create MXML file to define a view. Suppose
I understand that when adding a column to a table containing data in SQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.