Cocoa Equivalent to BufferedStreamReader?
Cocoa Equivalent to BufferedStreamReader?
- Subject: Cocoa Equivalent to BufferedStreamReader?
- From: Jeff LaMarche <email@hidden>
- Date: Tue, 6 Nov 2001 19:39:39 -0800
Right now I've got a very thread that simply loads an NSData from an
internet URL, like so:
thumbData = [NSData dataWithContentsOfURL:thumbURL];
[thumbData retain];
It works fine, but it's limited - I can't provide any feedback
concerning how much has been downloaded, nor can I kill the thread. I
read through the NSURL and NSURLHandle docs, and while I see some
alternative mechanisms of doing the same thing, they all seem to leave
all the work to Cocoa classes. NSURLHandle has a mechanism for killing a
load that's being done in the background but that's still not as much
control as I'd like.
Is there anything that allows you to read the data from a URL
line-by-line or byte-by-byte in a loop so that you can provide some
feedback about the progress and offer a way to cancel the load? In Java,
IIRC, you can load data from a URL using a BufferedStreamReader or
IOReader or one of the various reader classes (don't remember which one,
that's what JavaDoc is for =) ), which allows you to stop loading after
the current chunk.
Any suggestions or help is, as always, appreciated.
Jeff