• 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: Archiving NSColor as NSData
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Archiving NSColor as NSData


  • Subject: Re: Archiving NSColor as NSData
  • From: Jim Correia <email@hidden>
  • Date: Tue, 12 Aug 2008 21:12:02 -0400

On Aug 12, 2008, at 5:26 PM, Rein Hillmann wrote:

Could someone please explain why an NSColor yields so much data when archived to NSData?

For example, the following code:

NSColor* color = [NSColor yellowColor];
NSData* colorAsData = [NSArchiver archivedDataWithRootObject:color];
NSLog(@"colorAsData: %@", colorAsData);

yields the output:

colorAsData: <040b7374 7265616d 74797065 6481e803 84014084 8484074e 53436f6c 6f720084 84084e53 4f626a65 63740085 84016301 84046666 66660101 000186>

I suspect it's archiving other ivars in the color object. If so, is this much data in a single color object not a little extreme?

First off, are you having a performance (or other) problem due to the amount of data being archived, or is this just idle curiosity?


When you create an archive, you are creating a structured data stream with all the information necessary to recreate the object at runtime. This includes bookkeeping information put their by NSArchiver, required info like the type of the object you archived, and all of that objects private data. (In the case of archiving a color, just archiving 4 floats may not be enough information to recreate the color at runtime. For example, what colorspace was the color in?)

Jim

_______________________________________________

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: 
 >Archiving NSColor as NSData (From: Rein Hillmann <email@hidden>)

  • Prev by Date: Re: Accessing memory of another application?
  • Next by Date: RE: Subclassing NSTextView
  • Previous by thread: Archiving NSColor as NSData
  • Next by thread: Re: Archiving NSColor as NSData
  • Index(es):
    • Date
    • Thread