Is this how MemoryStreams works?
-
Hey! I need som help on the MemoryStream. 1. Is MemoryStream contaning one ore two streams? 1.2. If the MemoryStream only contains one stream, is it still posible to send data in both directions, or do i need to have two MemoryStreams to do that? 1.3. If the MemoryStream is containgn two streams, how do i know what stream i am reading and writing from? As you can see, i have some problem to understand Streams, if you got the time to explain, i would appreciate it! Best Regards Jimmy
-
Hey! I need som help on the MemoryStream. 1. Is MemoryStream contaning one ore two streams? 1.2. If the MemoryStream only contains one stream, is it still posible to send data in both directions, or do i need to have two MemoryStreams to do that? 1.3. If the MemoryStream is containgn two streams, how do i know what stream i am reading and writing from? As you can see, i have some problem to understand Streams, if you got the time to explain, i would appreciate it! Best Regards Jimmy
A stream (note lower case as this applicable in most languages) is simply a sequence of bytes. Think of it as a
byte[]
with methods writing data sequentially with a position pointer (like a textbox caret). The position can be changed (if allowed) to read a previously written part. Reading and writing happen at the position pointer in a forward sequential manner. ;) xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots -
A stream (note lower case as this applicable in most languages) is simply a sequence of bytes. Think of it as a
byte[]
with methods writing data sequentially with a position pointer (like a textbox caret). The position can be changed (if allowed) to read a previously written part. Reading and writing happen at the position pointer in a forward sequential manner. ;) xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots -
Okay understand But will i have to use two streams to be abled to send data in both directions? Best Regards SnowJim
A memorystream does not go anywhere, except to memory, so I am unsure what you could mean by "send data in both directions". In any case, if you need to both read from a stream, and write to a stream, you would normally use 2 streams to do that.