'nuther dumb question
'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