nsIOutputStream

IID:0d0acd2a-61b4-11d4-9877-00c04fa0cf4a
Inherits From:nsISupports

This interface is implemented by the following components:


Methods

void close ( ) void flush ( ) PRBool isNonBlocking ( ) PRUint32 write ( char* buf , PRUint32 count ) PRUint32 writeFrom ( nsIInputStream fromStream , PRUint32 count ) [noscript] PRUint32 writeSegments ( nsReadSegmentFun reader , voidPtr* closure , PRUint32 count )

void close ( )

Close the stream. Forces the output stream to flush any buffered data.


void flush ( )

Flush the stream.


PRBool isNonBlocking ( )

NOTE: writing to a blocking output stream will block the calling thread until all given data can be consumed by the stream.

Returns:
true if stream is non-blocking

PRUint32 write ( char* buf , PRUint32 count )

Write data into the stream.

Arguments:
buf: the buffer containing the data to be written
count: the maximum number of bytes to be written
Returns:
number of bytes written (may be less than aCount)

PRUint32 writeFrom ( nsIInputStream fromStream , PRUint32 count )

Writes data into the stream from an input stream.

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.

Arguments:
fromStream: the stream containing the data to be written
count: the maximum number of bytes to be written
Returns:
number of bytes written (may be less than aCount)

PRUint32 writeSegments ( nsReadSegmentFun reader , voidPtr* closure , PRUint32 count )

Low-level write method that has access to the stream's underlying buffer. The reader function may be called multiple times for segmented buffers. WriteSegments is expected to keep calling the reader until either there is nothing left to write or the reader returns an error. WriteSegments should not call the reader with zero bytes to provide.

NOTE: this function may be unimplemented if a stream has no underlying buffer (e.g., socket output stream).

Arguments:
reader: the "provider" of the data to be written
closure: opaque parameter passed to reader
count: the maximum number of bytes to be written
Returns:
number of bytes written (may be less than aCount)

References

This interface is the type of the following properties:

nsIDOMLSOutput.byteStream, nsIFastLoadFileIO.outputStream, nsIFileSpec.outputStream, nsIInputStreamTee.sink, nsIMsgFilterList.logStream, nsIMsgFolder.offlineStoreOutputStream, nsISpamSettings.logStream

This interface is passed as an argument to the following methods:

nsIAsyncStreamCopier.init, nsIBinaryOutputStream.setOutputStream, nsIBufferedOutputStream.init, nsIConverterOutputStream.init, nsIDOMSerializer.serializeToStream, nsIEditor.outputToStream, nsIFastLoadService.newOutputStream, nsIMimeEmitter.SetPipe, nsIMsgFolder.copyDataToOutputStreamForAppend, nsIPersistentProperties.save, nsIPluginInstancePeer.newStream, nsIRDFXMLSource.Serialize, nsISimpleStreamListener.init, nsIStreamListenerTee.init, nsIStreamTransportService.createOutputTransport, rdfISerializer.serialize

This interface is returned from the following methods:

nsICacheEntryDescriptor.openOutputStream, nsIStorageStream.getOutputStream, nsITransport.openOutputStream

Reference documentation is generated from Mozilla's source.

Add a note User Contributed Notes
No comments available

Copyright © 1999 - 2005 XULPlanet.com