从 C# 中的文件字段流式传输
我有一个以流(一个用于输入,另一个用于输出)作为参数的函数。它是加密功能,因此流可以非常大。但是流,该函数需要的不是整个文件,而是文件字段。那么,我如何将文件字段(它可能非常大,因此没有 MemoryStreams 等)放入流中?抱歉我的英语不好。
I have function with streams(one for input and another for output) as parametrs. It is cryptographic fucnction so streams can be very big. But stream, that function need is not a whole file it is file field.So, how I can put file field(it may be very big so no MemoryStreams etc.) in stream? Sorry for my bad english.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的意思是您需要提供一个属于文件(或任何其他 Stream)一部分的 Stream,那么您通常会使用以下两种方法之一:
如果您需要将该 Stream 传递到预先存在的代码/库,则第一个很有用。
在这两种情况下,IMO 设置流的代码应该担心“之前”的数据,而上面的代码只担心不读取太多数据。
编辑:这是我之前写的: http://protobuf -net.googlecode.com/svn/branches/v1/protobuf-net/SubStream.cs
If you mean you meed to supply a Stream that is a part of a file (or any other Stream) then you typically would use one of two approaches:
The first is useful if you need to pass that Stream to pre-existing code / libraries.
In both cases, IMO the code that sets up the stream should worry about the "before" data, with the above just worrying about not reading too much.
Edit: here's one I wrote earlier: http://protobuf-net.googlecode.com/svn/branches/v1/protobuf-net/SubStream.cs