• 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
'nuther dumb question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

'nuther dumb question


  • Subject: 'nuther dumb question
  • From: William Squires <email@hidden>
  • Date: Fri, 16 May 2014 18:46:57 -0500

  Why doesn't NSData have a +[NSData dataWithString:(NSString *)] or -[NSData initWithString:(NSString *)] method? i.e. how do I convert the contents of an NSString object into an NSData object? Why? Because -[NSFileHandle writeData:(NSData *)] takes an NSData object, not an NSString object. Arrrgghhhh. :(
  Also, how come NSFileHandle doesn't have a -[NSFileHandle readFileWithSeparator:(NSString *)] method so one can read in only chunks of a file (of varying size, such as CSV records, or lines in a text file, separated by \n, as opposed to a fixed size, which could be accomplished with -[NSFileHandle readDataOfLength:(NSUInteger)] instead), instead of having to read in the whole thing? Especially on iOS, where memory space is at a premium!
  This seems like a major oversight to me... unless maybe there's a class which provides a higher-level of abstraction, such as NSTextFileHandle? Yeah, I can drop down to the C-level fopen(), fread(), fwrite(), fclose() etc... functions, but I'm looking for an OO-way to do this.



_______________________________________________

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


  • Follow-Ups:
    • Re: 'nuther dumb question
      • From: Graham Cox <email@hidden>
    • Re: 'nuther dumb question
      • From: Graham Cox <email@hidden>
    • Re: 'nuther dumb question
      • From: Graham Cox <email@hidden>
    • Re: 'nuther dumb question
      • From: Sixten Otto <email@hidden>
    • Re: 'nuther dumb question
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Share and store RSA - public key in java server and vice versa
  • Next by Date: Re: 'nuther dumb question
  • Previous by thread: setUsesFontPanel:NO for a given NSColorWell only
  • Next by thread: Re: 'nuther dumb question
  • Index(es):
    • Date
    • Thread