使用 Stream.BeginRead 方法时如何判断数据的来源?
当使用 Stream.BeginRead 方法,并且您正在从流中读取数据到内存中时,如何确定您从哪里读取数据?
看: http://msdn.microsoft.com/en- us/library/system.io.stream.beginread.aspx
在参数列表中,我没有看到一个告诉从哪里读取数据的参数:
参数
- buffer 类型:System.Byte[] The buffer to将数据读入。
- offset 类型:System.Int32 缓冲区中开始写入从流中读取的数据的字节偏移量
- count 类型:System.Int32 要读取的最大字节数。
- callback 类型:System.AsyncCallback 一个可选的异步回调,在读取完成时调用。
- state 类型:System.Object 用户提供的对象,用于区分此特定异步读取请求和其他异步读取请求 请求。
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
- count 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它从流到达的任何位置读取数据,由
位置
属性。请注意,并非所有流都支持查找,因此您不一定要设置
Position
。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
.