You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.
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_BLOCK
if 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 (sincereadSegments
was called).aCount:
The length offromSegment
.aWriteCount:
The number of bytes read.Note: Implementers should return the following:
NS_OK
and (*aWriteCount > 0
) if consumed some data;NS_BASE_STREAM_WOULD_BLOCK
if not interested in consuming any data; <other-error> on failure. Errors are passed to the caller ofReadSegments
, unlessaToOffset
is greater than zero.Returning
NS_OK
and (*aWriteCount = 0
) has undefined behavior.Returns:
ThrowsNS_BASE_STREAM_WOULD_BLOCK
if 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
TRUE
if stream is non-blocking.Syntax:
boolean nsIInputStream::isNonBlocking()Parameters:
Returns:
Written by:Ellen Evans | Comments, questions, complaints?
Bug 143387 |