开发者

How can you tell the source of the data when using the Stream.BeginRead Method?

When using the Stream.BeginRead Method, and you are reading from a stream into a memory, how is it determined where you are reading the data from?

See: http://msdn.microsoft.com/en-us/library/system.io.stream.beginread.aspx

In the list of parameters, I do not see one that tells where the data is being read from:

Parameters

  • buffer Type: System.Byte[] The buffer to read the data into.
  • offset Type: System.Int32 The byte offset in buffer at which to begin writing data read from the stream
  • c开发者_Python百科ount Type: System.Int32 The maximum number of bytes to read.
  • callback Type: System.AsyncCallback An optional asynchronous callback, to be called when the read is complete.
  • state Type: System.Object A user-provided object that distinguishes this particular asynchronous read request from other requests.


It reads the data from wherever the stream is up to, as determined by the Position property.

Note that not all streams support seeking, so you cannot necessarily set Position.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜