• 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: Saving data to a file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving data to a file


  • Subject: Re: Saving data to a file
  • From: petite_abeille <email@hidden>
  • Date: Sat, 15 Mar 2003 13:09:23 +0100

On 3/14/03 4:48 PM, "Ron Phillips" <email@hidden> wrote:

I have scoured the cocoa-dev archives, web sites and books and still am
confused on how best to write data to a file from a non-document-based
application. An XML format is fine, human-readable is not required. I
have a collection of arrays, ints, strings, and BOOLs. What
preparation is needed for a property list? Chris Kane indicated that
archiving is not compatible with plists and writeToFile:atomically:.
That's cool, so do I just *somehow* wrap up my high-level object into
an NSData object and do the write? If so, what's the best approach to
do that? Is encoding still needed?

"An NSArchiver encodes objects into a format that can be written to a file."
-- [NSArchiver]
file://localhost/System/Library/Frameworks/Foundation.framework/ Versions/C/Resources/English.lproj/Documentation/Reference/ ObjC_classic/Classes/NSArchiver.html#//apple_ref/occ/clm/NSArchiver/ archivedDataWithRootObject:


"The NSCoder abstract class declares the interface used by concrete subclasses to transfer objects and other Objective-C data items between memory and some other format. This capability provides the basis for archiving (where objects and data items are stored on disk) and distribution (where objects and data items are copied between different processes or threads). "
-- <NSCoder>
file://localhost/Developer/Documentation/Cocoa/Reference/Foundation/ ObjC_classic/Classes/NSCoder.html


"Archives and serializations are two ways in which you can create architecture-independent byte streams of hierarchical data. Byte streams can then be written to a file or transmitted to another process, perhaps over a network. When the byte stream is decoded, the hierarchy is regenerated. Archives provide a detailed record of a collection of interrelated objects and values."
-- Archives and Serializations
file://localhost/Developer/Documentation/Cocoa/TasksAndConcepts/ ProgrammingTopics/Archiving/index.html#//apple_ref/doc/uid/10000047i


Cheers,

PA.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Saving data to a file (From: sinclair44 <email@hidden>)

  • Prev by Date: Re: State of Cocoa adoption
  • Next by Date: Intermittent crash
  • Previous by thread: Re: Saving data to a file
  • Next by thread: RE: Saving data to a file
  • Index(es):
    • Date
    • Thread