diff --git a/mozilla/xpcom/io/nsIStringStream.cpp b/mozilla/xpcom/io/nsIStringStream.cpp index a31b621ef41..ac7721b34b8 100644 --- a/mozilla/xpcom/io/nsIStringStream.cpp +++ b/mozilla/xpcom/io/nsIStringStream.cpp @@ -493,3 +493,25 @@ extern "C" NS_COM nsresult NS_NewCharIOStream( { return NS_NewCharOutputStream(aStreamResult, aStringToChange); } + +//---------------------------------------------------------------------------------------- +extern "C" NS_COM nsresult NS_NewByteInputStream( + nsISupports** aStreamResult, + const char* aStringToRead, + PRInt32 aLength) + // Factory method to get an nsInputStream from a string. Result will implement all the + // file stream interfaces in nsIFileStream.h +//---------------------------------------------------------------------------------------- +{ + NS_PRECONDITION(aStreamResult != nsnull, "null ptr"); + if (! aStreamResult) + return NS_ERROR_NULL_POINTER; + + ConstCharImpl* stream = new ConstCharImpl(aStringToRead, aLength); + if (! stream) + return NS_ERROR_OUT_OF_MEMORY; + + NS_ADDREF(stream); + *aStreamResult = (nsISupports*)(void*)stream; + return NS_OK; +} \ No newline at end of file diff --git a/mozilla/xpcom/io/nsIStringStream.h b/mozilla/xpcom/io/nsIStringStream.h index 8a64eb91f68..cce458cdfe2 100644 --- a/mozilla/xpcom/io/nsIStringStream.h +++ b/mozilla/xpcom/io/nsIStringStream.h @@ -75,4 +75,11 @@ extern "C" NS_COM nsresult NS_NewCharIOStream( // Factory method to get an nsOutputStream to a string. Result will implement all the // file stream interfaces in nsIFileStream.h +//---------------------------------------------------------------------------------------- +extern "C" NS_COM nsresult NS_NewByteInputStream( + nsISupports** aStreamResult, + const char* aStringToRead, + PRInt32 aLength); + // Factory method to get an nsInputStream from a string. Result will implement all the + // #endif /* nsIStringStream_h___ */