How about tracking the number of written objects when saving the document, then encoding an additional key containing the object count at the top level of the archive? This could then be retrieved before decoding the root object.
A possible problem with this idea is that it might require the data for the root object to be read into memory before the count can be read. Maybe this wouldn't be a problem with a binary format --- I don't know enough about the implementation of NSKeyedArchiver/Unarchiver to be sure. On 16 September 2013 13:53, Graham Cox <graham....@bigpond.com> wrote: > Hi all, > > If I wanted to add some sort of progress reporting to archiving and > dearchiving, what's a good way to do it? The problem seems to me to know > what the 'count' of things read from/written to the file is to set the > progress max value. Since the delegate gets called for each object > instantiated, that part of it isn't a problem, I can just bump a counter. > Counting the objects rather than actual bytes is probably as fine-grained > as I need to get. > > --Graham > > > > _______________________________________________ > > 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: > > https://lists.apple.com/mailman/options/cocoa-dev/devereux.chris%40gmail.com > > This email sent to devereux.ch...@gmail.com _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com