[英]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.