Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the meaning of "seekable" stream?

Tags:

c#

stream

I know there are seekable streams(like MemoryStream and FileStream) and non-seekable streams(like Network Stream).
MSDN says about seek method

Seeking to any location beyond the length of the stream is supported.

But I didn't understand that! I tried to find an answer in the web but I failed.

like image 248
Dot Freelancer Avatar asked Aug 07 '14 08:08

Dot Freelancer


1 Answers

Seekable means you can manually set the position of the cursor within the stream, i.e. you can read/write a byte at any location. You're not obliged to read a byte so the cursor position is incremented.

Seeking after the current stream length will basically expand the stream length (for example your file will grow for a FileStream).

like image 170
ken2k Avatar answered Oct 29 '22 00:10

ken2k