Re: nsIInputStream::available
Darin Fisher <[email protected]> Sun, 09 May 2004 15:07:37 -0700
| Newsgroups | gmane.comp.mozilla.devel.netlib,gmane.comp.mozilla.devel.xpcom |
|---|---|
| Message-ID | <[email protected]> |
Christian Biesinger wrote: > Hi, > I've got a question about nsIInputStream::available... > > It is documented as follows: > 90 /** > 91 * @return number of bytes currently available in the stream > 92 */ > 93 unsigned long available(); > > So, my question is, what does it mean for available() to return 0? > > Does it indicate that at the moment, no data is available, but at a > later time available() may return a number > 0? > Yes, it indicates that at the moment there is no data. > Or, does it indicate EOF? > No, it does not indicate EOF. > If the former is the case, how is it possible to detect EOF on a > blocking input stream? Call, Read and check what it returns. If it returns NS_OK and zero bytes read, then that means EOF. -Darin