On Oct 1, 2011, at 10:09 AM, dgoughnour wrote:
> I am still curious as to the 'correct' way to do this. I do want to check
> the size of the image before I download it Because some of them may be
> REALLY large. Currently I am downloading the entire image into a memory
> buffer and then parsing just the bounds so I can get the desired scale, then
> the image from the same memory buffer.

If you don't know how big it is, downloading into memory probably isn't a good 
idea. :-)

> If I just use the response stream to get the
> bounds can I either rewind it and reuse it to actually decode the image

The response Stream does not support seeking, so this isn't a viable solution 
either.

I would suggest using System.IO.Path.GetTempFileName(), creating a FileStream 
over that, and copying the network stream data into the temp file. Then you can 
do as you will with it.

Note: Path.GetTempFileName() (1) creates a file (so you _may_ want to 
File.Delete() it when done), and (2) the file is in the $HOME/../cache 
directory, e.g. /data/data/YOUR.PACKAGE.NAME.HERE/cache.

 - Jon

_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to