Re: NSFileWrapper
Re: NSFileWrapper
- Subject: Re: NSFileWrapper
- From: Jens Alfke <email@hidden>
- Date: Sat, 04 Jun 2016 09:42:11 -0700
> On Jun 4, 2016, at 9:18 AM, Peter Hudson <email@hidden> wrote:
>
> You're right - I want the behaviour of a package. Do you happen to know how I can achieve it? I had presumed it might be some mix of flag setting at system level. If for example i set the extension on an NSFileWrapper to .bundle i get some of what I need - but I cant find out how to get an icon of my choosing associated with it.
It’s part of the document-type declaration in your app’s Info.plist.
I wouldn’t recommend NSFileWrapper for large files, because it reads all of a file into memory. The same goes for the usual file-I/O convenience methods on NSData, NSString. etc. — for some reason the Foundation APIs have always been biased toward reading/writing entire files. This is very convenient, but not scaleable.
If your app’s performance is suffering because of large files, then use streams instead, and try to only read the part of the file that’s necessary. Or use a database like SQLite, which can easily handle terabyte-size files. (If you don’t want to deal with SQL queries, there are simpler key/value databases like LevelDB, LMDB, Kyoto Cabinet and Berkeley DB.)
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden