
nsIInputStream
This interface manages reading data in from an input stream. It is partially scriptable.
Syntax:
void nsIInputStream::close()Parameters:
nsresult:
Gets number of bytes currently available in the stream.
Syntax:
unsigned long nsIInputStream::available()Parameters:
Returns:
Reads data from the stream. This method is not scriptable.
Syntax:
unsigned long nsIInputStream::read(in charPtr aBuf, in unsigned long aCount)Parameters:
Returns:
ThrowsNS_BASE_STREAM_WOULD_BLOCKif reading from the input stream would block the calling thread (non-blocking mode only).
Low-level read method that has access to the stream's underlying buffer. The writer function may be called multiple times for segmented buffers. This method is not scriptable.
Syntax:
unsigned long nsIInputStream::readSegments( in nsWriteSegmentFun aWriter, in voidPtr aClosure, in unsigned long aCount)Parameters:
typedef NS_CALLBACK(nsWriteSegmentFun)( nsIInputStream *aInStream, void *aClosure, const char *aFromSegment, PRUint32 aToOffset, PRUint32 aCount, PRUint32 *aWriteCount);
aInStream:The stream being read.aClosure:Opaque parameter passed toreadSegments.aFromSegment:A pointer to memory owned by the input stream.aToOffset:The amount already read (sincereadSegmentswas called).aCount:The length offromSegment.aWriteCount:The number of bytes read.Note: Implementers should return the following:
NS_OKand (*aWriteCount > 0) if consumed some data;NS_BASE_STREAM_WOULD_BLOCKif not interested in consuming any data; <other-error> on failure. Errors are passed to the caller ofReadSegments, unlessaToOffsetis greater than zero.Returning
NS_OKand (*aWriteCount = 0) has undefined behavior.Returns:
ThrowsNS_BASE_STREAM_WOULD_BLOCKif reading from the input stream would block the calling thread (non-blocking mode only).
Note: This method may be unimplemented if a stream has no underlying buffer (e.g., socket input stream).
Returns
TRUEif stream is non-blocking.Syntax:
boolean nsIInputStream::isNonBlocking()Parameters:
Returns:
| Written by:Ellen Evans | Comments, questions, complaints?
Bug 143387 |