Results 1 to 2 of 2

Thread: [RESOLVED] Reader/writer class VS stream class

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2018
    Posts
    136

    Resolved [RESOLVED] Reader/writer class VS stream class

    What's the difference between a reader/writer class and stream class??

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: Reader/writer class VS stream class

    A Stream literally represents a stream of raw data, i.e. a series of Bytes that flows from a source to a destination. Readers and writers generally sit on top of a something (often a Stream) and translate that data in some way. For instance, the TextReader and TextWriter classes do as their names suggest and all reading and writing of text. The StreamReader and StreamWriter classes inherit TextReader and TextWriter and provide that text reading and writing functionality for Streams. The translation is done from Bytes to text or from text to Bytes using an Encoding. The underlying Stream can be any type, e.g. FileStream, MemoryStream, NetworkStream. This means that you can read text from and write text to a Stream in exactly the same way regardless of what's at the other end.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width