• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSDocument custom file Package or URL override?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDocument custom file Package or URL override?


  • Subject: Re: NSDocument custom file Package or URL override?
  • From: Markus Spoettl <email@hidden>
  • Date: Fri, 17 May 2013 09:11:55 +0200

On 5/17/13 8:11 AM, Trygve Inda wrote:
One issue is that when opening my document (the package may contain several
thousand files) I only really need to load one file (the plist) and then
there rest of the files are images that are only read as needed... So I will
need to have my doc keep a reference to the package location to read these
images outside of the normal save/read methods.

In looking at the docs:

- (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName
error:(NSError **)outError

  it says " Sets the contents of this document by reading from a file or file
package, of a specified type, located by a URL."

So this seems to work for document packages too??

Yes, sure, but:

An alternative is to hold on to the packages sub-wrappers and read their content on demand only. No one forces you to load the wrappers' contents at the time your document is opened, so you would only actually load your plist and keep the other wrappers around.

That also gives you to possibility to reuse the wrappers when you need to save your document. When you reuse an "old" wrapper (say because the content of the file the wrapper represents didn't change), it dramatically shortens the time needed to save the document - if you have many files to save and/or if they are big. That's because the content won't be written twice, the system just creates a hard link to the original file on the disk.

Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________

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

References: 
 >Re: NSDocument custom file Package or URL override? (From: Trygve Inda <email@hidden>)

  • Prev by Date: Re: NSMutableDictionary or Custom Object when adding properties?
  • Next by Date: Re: NSMutableDictionary or Custom Object when adding properties?
  • Previous by thread: Re: NSDocument custom file Package or URL override?
  • Next by thread: Getting a splash screen to show
  • Index(es):
    • Date
    • Thread