WARNING: Most of this content (with the exception of the Mozilla 1.9 XPCOM reference) is very old, and can be expected to be out of date and possibly obsolete. For better XUL documentation, please visit the XUL hub at the Mozilla Developer Center.

nsIStringInputStream

IID:450cd2d4-f0fd-424d-b365-b1251f80fd53
Inherits From:nsIInputStream
Status:UNDER_REVIEW

Provides scriptable and specialized C++-only methods for initializing a nsIInputStream implementation with a simple character array.

This interface is intended to be used as an instance. To create an object implementing this interface:

var obj = Components.classes["@mozilla.org/io/string-input-stream;1"].
            createInstance(Components.interfaces.nsIStringInputStream);

This interface is implemented by the following components:


Methods

[noscript] void adoptData ( charPtr* data , PRInt32 datlen ) void setData ( char* data , PRInt32 datlen ) [noscript] void shareData ( char* data , PRInt32 datlen )

void adoptData ( charPtr* data , PRInt32 datlen )

AdoptData - assign data to the input stream. the input stream takes ownership of the given data buffer and will nsMemory::Free it when the input stream is destroyed.

Arguments:
data: - stream data
datlen: - stream data length (-1 if length should be computed)

void setData ( char* data , PRInt32 datlen )

SetData - assign data to the input stream (copied on assignment).

NOTE: C++ code should consider using AdoptData or ShareData to avoid making an extra copy of the stream data.

NOTE: For JS callers, the given data must not contain null characters (other than a null terminator) because a null character in the middle of the data string will be seen as a terminator when the data is converted from a JS string to a C++ character array.

Arguments:
data: - stream data
datlen: - stream data length (-1 if length should be computed)

void shareData ( char* data , PRInt32 datlen )

ShareData - assign data to the input stream. the input stream references the given data buffer until the input stream is destroyed. the given data buffer must outlive the input stream.

Arguments:
data: - stream data
datlen: - stream data length (-1 if length should be computed)

Reference documentation is generated from Mozilla's source.