Tags: binary, file, fromwebresponse, getresponsestream, huge, net, sharp, stream, write
How to write a huge stream to a file?
I want to write a big binary stream that was getting from
WebResponse.GetResponseStream() to a file. Anyone can help?
Leave a comment...
- 1 Comments
- Rudy Ko <rko.net-csharp.questionfor.info.lucent.com> wrote:
> I want to write a big binary stream that was getting from
> WebResponse.GetResponseStream() to a file. Anyone can help?
Sure. Open the stream to write to, and then just read blocks at a time
out of GetResponseStream, writing them to the output stream. Stop when
Read returns a value <= 0. Note that you must only write out the number
of bytes read at any one time - don't assume that the buffer will have
Jon Skeet - <skeet.net-csharp.questionfor.info.pobox.com>
If replying to the group, please do not mail me too#1; Mon, 31 Dec 2007 13:07:00 GMT