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.
nsIOutputStream
This interface manages writing data to an output stream. It is partially scriptable.
Closes the stream. Forces the output stream to flush any buffered data.
Syntax:
void nsIOutputStream::close()Parameters:
nsresult:
ThrowsNS_BASE_STREAM_WOULD_BLOCK
if unable to flush without blocking the calling thread (non-blocking mode only)
Syntax:
void nsIOutputStream::flush()Parameters:
nsresult:
ThrowsNS_BASE_STREAM_WOULD_BLOCK
if unable to flush without blocking the calling thread (non-blocking mode only).
Writes data into the stream from an input stream.
Syntax:
unsigned long nsIOutputStream::write(in string aBuf, in unsigned long aCount)Parameters:
Returns:
ThrowsNS_BASE_STREAM_WOULD_BLOCK
if unable to flush without blocking the calling thread (non-blocking mode only)
Writes data into the stream from an input stream.
Syntax:
unsigned long nsIOutputStream::writeFrom( in nsIInputStream aFromStream, in unsigned long aCount)Parameters:
Returns:
ThrowsNS_BASE_STREAM_WOULD_BLOCK
if unable to flush without blocking the calling thread (non-blocking mode only)
Note: This method is defined by this interface in order to allow the output stream to efficiently copy the data from the input stream into its internal buffer (if any). If this method was provided as an external facility, a separate char* buffer would need to be used in order to call the output stream's other Write method.
Low-level write method that has access to the stream's underlying buffer. The reader function may be called multiple times for segmented buffers. This method is not scriptable.
Syntax:
unsigned long nsIOutputStream::writeSegments( in nsReadSegmentFun aReader, in voidPtr aClosure, in unsigned long aCount)Parameters:
typedef NS_CALLBACK(nsReadSegmentFun)( nsIOutputStream *aOutStream, void *aClosure, char *aToSegment, PRUint32 aFromOffset, PRUint32 aCount, PRUint32 *aReadCount)
aOutStream:
The stream being written to.aClosure:
Opaque parameter passed towriteSegments
.aToSegment:
A pointer to memory owned by the output stream.aFromOffset:
The amount already written (sincewriteSegments
was called).aCount:
The length oftoSegment
.aReadCount:
The number of bytes written.Note: Implementers should return the following:
NS_OK
and (*aReadCount > 0
) if successfully provided some data;NS_OK
and (*aReadCount = 0
); orNS_BASE_STREAM_WOULD_BLOCK
if not interested in providing any data;<other-error> on failureErrors are passed to the caller of
writeSegments
, unlessaFromOffse
t is greater than zero.Returns:
ThrowsNS_BASE_STREAM_WOULD_BLOCK
if writing to the output stream would block the calling thread (non-blocking mode only).
Note: this function may be unimplemented if a stream has no underlying buffer (e.g., socket output stream).
Returns
TRUE
if stream is non-blocking.Syntax:
boolean nsIOutputStream::isNonBlocking()Parameters:
Returns:
Written by:Ellen Evans | Comments, questions, complaints?
Bug 143387 |