简体   繁体   中英

Is it ambiguous in Apple Document when -[NSInputStream read:maxLength:] return 0?

In NSInputStream Apple Document, it states that when -[NSInputStream read:maxLength:] return 0,

  • 0 indicates that the end of the buffer was reached.

Is 'the buffer' referring to the buffer that user assigns to read parameter or the read buffer, aka the stream itself.

If it refers to the first case, that means data filled up the user's buffer. It is possible that there may be more data to come.

If it refers to the latter case, that means no more data to come. So it is time to clean up.

This kind of ambiguity does waste people's time to figure it out.

It refers the stream buffer. If the provided buffer is filled, the return value will be len .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM