简体   繁体   English

当-[NSInputStream read:maxLength:]返回0时,它在Apple Document中是否模棱两可?

[英]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, 在Apple文档的NSInputStream中,它指出-[[NSInputStream read:maxLength:]返回0时,

  • 0 indicates that the end of the buffer was reached. 0表示到达缓冲区末尾。

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 . 如果提供的缓冲区已满,则返回值为len

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 NSInputStream读取:maxlength:返回的字节数比maxlength多 - NSInputStream read: maxlength: returning way more bytes than maxlength [(NSInputStream *)stream read:buf maxLength:1024]; 回报非常巨大的价值 - [(NSInputStream *)stream read:buf maxLength:1024]; returns very huge value 如果[nsInputStream close]被另一个线程调用,是否应该返回[nsInputStream read:…]? - Should [nsInputStream read:…] return if [nsInputStream close] is called by another thread? - [NSInputStream read:maxLength:]抛出一个异常,说长度太大,但事实并非如此 - -[NSInputStream read:maxLength:] throws an exception saying length is too big, but it isn't 当可用字节时,NSInputStream读取返回无符号整数最大值 - NSInputStream read returns unsigned integer maximum value when bytes available 如何将NSInputStream转换为NSString或如何读取NSInputStream - How to convert NSInputStream to NSString or how to read NSInputStream 如何阅读Apple开发人员文档 - How to read Apple developer document 如何使用UTF-8读取NSInputStream? - How to read a NSInputStream with UTF-8? 使用NSOutputstream和NSInputstream写入和读取每个间隔 - Use NSOutputstream and NSInputstream to write and read every interval 无法从NSInputStream读取自定义文件 - Can't read custom file from NSInputStream
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM