Re: When does NSInputStream's -getBuffer:length: actually work?
Re: When does NSInputStream's -getBuffer:length: actually work?
- Subject: Re: When does NSInputStream's -getBuffer:length: actually work?
- From: Wim Lewis <email@hidden>
- Date: Wed, 25 Jul 2012 11:03:06 -0700
On 25 Jul 2012, at 10:08 AM, Jens Alfke wrote:
> NSInputStream has a -getBuffer:length: method that lets you get the available data from the stream without copying. This is great for performance, and I've written my client code to take advantage of it if it's supported, but every time I've tested, it isn't supported (i.e. just returns NO) so my code just falls back to calling -read:maxLength: instead.
>
> Does anyone know in what circumstances, or in what types of streams, this method actually works?
It sort of works for streams reading from a memory buffer, IIRC. By "sort of", I mean it sometimes returns data and sometimes silently discards data. I now avoid NSStream/CFStream unless I'm dealing with an API that requires them--- they seem to be an unmaintained corner of the codebase.
_______________________________________________
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