简体   繁体   中英

What's the meaning of “seekable” 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.

Seekable means you can manually set the position of the cursor within the stream, ie 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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM