• 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: NSArray to NSData
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArray to NSData


  • Subject: Re: NSArray to NSData
  • From: Robert Walker <email@hidden>
  • Date: Wed, 8 Mar 2006 11:37:34 -0500

Is there a receipe around how to make a NSData out of the NSArray easily?

NSArray itself is serializable (i.e. Implements the Serializable interface). EOGenericRecord is also serializable. So if your NSArray contains a list of EOGenericRecords then you can serialize the array without any real effort.


If your NSArray contains custom objects then you need to implement the Serializable interface for those objects, along with any other types of objects referenced within the array.

What I've done for this purpose is use XML serialization then ZIP the XML and store the ZIP file in a blob field. I basically just wrote utility methods for encoding/zipping and unzipping/decoding. To make things even easier, I typically just store the data in NSArrays of NSDictionaries (similar to or exactly raw rows) so I don't have to worry about implementing the Serializable interface for custom objects, but that implementation is not really hard to do either.

See: http://developer.apple.com/documentation/WebObjects/ XML_Serialization/index.html for more information.

On Mar 8, 2006, at 11:18 AM, Wolfram Stebel wrote:

Sorry for posting without ref.

Hi all,

i would like to store a NSArray with it's content into a blob (and restore
it back from there too) in the database.
I found that i need a NSData to put into the blob.
Is there a receipe around how to make a NSData out of the NSArray easily?


TIA

Wolfram


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com


This email sent to email@hidden

Robert Walker email@hidden



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSArray to NSData (From: Wolfram Stebel <email@hidden>)

  • Prev by Date: Re: EOF Caching / performance question
  • Next by Date: Re: EOF Caching / performance question
  • Previous by thread: Re: NSArray to NSData
  • Next by thread: OOM / java.lang.OutOfMemoryError
  • Index(es):
    • Date
    • Thread