Will thanks for the heads up, for my purposes this time around, the
input stream will be coming in off the file system, but I did not want
to load the whole thing into an NSData object.

Ah! Well, your approach will work, but if your file is less than 4GB I highly recommend something like:

NSData *fileData = [NSData dataWithContentsOfFile:path options:NSUncachedRead error:&error];

This is NOT implemented by Apple in a naïve way - eg, it doesn't read the whole dang file and blat it into memory. Instead, it reads blocks on-demand, in a most efficient manner.

In my tests "NSUncachedRead" is very, VERY fast, great if you are only going to use each byte once. "NSMappedRead" has a different set of constraints but can also be very fast.

-Wil_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to