1999-04-22 07:31:03 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
1999-04-13 18:15:49 +00:00
|
|
|
*
|
1999-11-06 03:43:54 +00:00
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
1999-04-13 18:15:49 +00:00
|
|
|
*
|
1999-11-06 03:43:54 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
1999-04-13 18:15:49 +00:00
|
|
|
*
|
1999-11-06 03:43:54 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1999-04-13 18:15:49 +00:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 03:43:54 +00:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
1999-04-13 18:15:49 +00:00
|
|
|
*/
|
|
|
|
|
1999-03-05 20:55:10 +00:00
|
|
|
#include "nsIStringStream.h"
|
|
|
|
#include "nsIFileStream.h"
|
|
|
|
|
|
|
|
#include "prerror.h"
|
|
|
|
#include "nsFileSpec.h"
|
|
|
|
#include "plstr.h"
|
|
|
|
|
|
|
|
//========================================================================================
|
|
|
|
class BasicStringImpl
|
|
|
|
: public nsIOutputStream
|
|
|
|
, public nsIInputStream
|
|
|
|
, public nsIRandomAccessStore
|
|
|
|
//========================================================================================
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
BasicStringImpl()
|
1999-03-19 23:09:39 +00:00
|
|
|
: mOffset(0)
|
|
|
|
, mLastResult(NS_OK)
|
1999-03-05 20:55:10 +00:00
|
|
|
, mEOF(PR_FALSE)
|
|
|
|
{
|
|
|
|
NS_INIT_REFCNT();
|
|
|
|
}
|
|
|
|
virtual ~BasicStringImpl()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
NS_IMETHOD Seek(PRSeekWhence whence, PRInt32 offset);
|
|
|
|
|
|
|
|
NS_IMETHOD Tell(PRIntn* outWhere)
|
|
|
|
{
|
|
|
|
*outWhere = mOffset;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHOD GetAtEOF(PRBool* outAtEOF)
|
|
|
|
{
|
|
|
|
*outAtEOF = mEOF;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHOD SetAtEOF(PRBool inAtEOF)
|
|
|
|
{
|
|
|
|
mEOF = inAtEOF;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-09-09 22:05:05 +00:00
|
|
|
NS_IMETHOD Available(PRUint32 *aLength)
|
1999-03-05 20:55:10 +00:00
|
|
|
{
|
|
|
|
NS_PRECONDITION(aLength != nsnull, "null ptr");
|
|
|
|
if (!aLength)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
*aLength = length();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHOD Read(char* aBuf,
|
|
|
|
PRUint32 aCount,
|
|
|
|
PRUint32 *aReadCount)
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(aBuf != nsnull, "null ptr");
|
|
|
|
if (!aBuf)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
NS_PRECONDITION(aReadCount != nsnull, "null ptr");
|
|
|
|
if (!aReadCount)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
1999-03-19 23:09:39 +00:00
|
|
|
if (NS_FAILED(mLastResult))
|
|
|
|
return mLastResult;
|
1999-03-05 20:55:10 +00:00
|
|
|
PRInt32 bytesRead = read(aBuf, aCount);
|
1999-03-19 23:09:39 +00:00
|
|
|
if (NS_FAILED(mLastResult))
|
1999-03-05 20:55:10 +00:00
|
|
|
{
|
|
|
|
*aReadCount = 0;
|
1999-03-19 23:09:39 +00:00
|
|
|
return mLastResult;
|
1999-03-05 20:55:10 +00:00
|
|
|
}
|
|
|
|
*aReadCount = bytesRead;
|
1999-03-19 23:09:39 +00:00
|
|
|
if (bytesRead < (PRInt32)aCount)
|
1999-03-05 20:55:10 +00:00
|
|
|
SetAtEOF(PR_TRUE);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
// nsIOutputStream interface
|
|
|
|
NS_IMETHOD Write(const char* aBuf,
|
|
|
|
PRUint32 aCount,
|
|
|
|
PRUint32 *aWriteCount)
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(aBuf != nsnull, "null ptr");
|
|
|
|
NS_PRECONDITION(aWriteCount != nsnull, "null ptr");
|
|
|
|
|
1999-03-19 23:09:39 +00:00
|
|
|
if (NS_FAILED(mLastResult))
|
|
|
|
return mLastResult;
|
1999-03-05 20:55:10 +00:00
|
|
|
PRInt32 bytesWrit = write(aBuf, aCount);
|
1999-03-19 23:09:39 +00:00
|
|
|
if (NS_FAILED(mLastResult))
|
1999-03-05 20:55:10 +00:00
|
|
|
{
|
|
|
|
*aWriteCount = 0;
|
1999-03-19 23:09:39 +00:00
|
|
|
return mLastResult;
|
1999-03-05 20:55:10 +00:00
|
|
|
}
|
|
|
|
*aWriteCount = bytesWrit;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
public:
|
|
|
|
|
|
|
|
// nsISupports interface
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
NS_IMETHOD Close() { return NS_OK; }
|
|
|
|
|
|
|
|
// nsIInputStream interface
|
|
|
|
NS_IMETHOD Flush() { return NS_OK; }
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
1999-03-19 23:09:39 +00:00
|
|
|
nsresult get_result() const { return mLastResult; }
|
1999-03-05 20:55:10 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual PRInt32 length() const = 0;
|
|
|
|
virtual PRInt32 read(char* buf, PRUint32 count) = 0;
|
|
|
|
virtual PRInt32 write(const char*, PRUint32)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(PR_FALSE, "Write to a const string");
|
1999-03-19 23:09:39 +00:00
|
|
|
mLastResult = NS_FILE_RESULT(PR_ILLEGAL_ACCESS_ERROR);
|
1999-03-05 20:55:10 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
PRUint32 mOffset;
|
1999-03-19 23:09:39 +00:00
|
|
|
nsresult mLastResult;
|
1999-03-05 20:55:10 +00:00
|
|
|
PRBool mEOF;
|
|
|
|
}; // class BasicStringImpl
|
|
|
|
|
|
|
|
//========================================================================================
|
|
|
|
class ConstCharImpl
|
|
|
|
: public BasicStringImpl
|
|
|
|
//========================================================================================
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ConstCharImpl(const char* inString)
|
|
|
|
: mConstString(inString)
|
|
|
|
, mLength(inString ? strlen(inString) : 0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual PRInt32 length() const
|
|
|
|
{
|
1999-07-03 06:49:28 +00:00
|
|
|
return mLength - mOffset;
|
1999-03-05 20:55:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual PRInt32 read(char* buf, PRUint32 aCount)
|
|
|
|
{
|
|
|
|
PRInt32 maxCount = mLength - mOffset;
|
1999-03-19 23:09:39 +00:00
|
|
|
if ((PRInt32)aCount > maxCount)
|
1999-03-05 20:55:10 +00:00
|
|
|
aCount = maxCount;
|
|
|
|
memcpy(buf, mConstString + mOffset, aCount);
|
|
|
|
mOffset += aCount;
|
|
|
|
return aCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
const char* mConstString;
|
|
|
|
size_t mLength;
|
|
|
|
|
|
|
|
}; // class ConstCharImpl
|
|
|
|
|
|
|
|
//========================================================================================
|
|
|
|
class CharImpl
|
|
|
|
: public ConstCharImpl
|
|
|
|
//========================================================================================
|
|
|
|
{
|
|
|
|
enum { kAllocQuantum = 256 };
|
|
|
|
|
|
|
|
public:
|
|
|
|
CharImpl(char** inString)
|
|
|
|
: ConstCharImpl(*inString)
|
|
|
|
, mString(*inString)
|
|
|
|
, mAllocLength(mLength + 1)
|
|
|
|
, mOriginalLength(mLength)
|
|
|
|
{
|
|
|
|
if (!mString)
|
|
|
|
{
|
1999-06-10 19:51:36 +00:00
|
|
|
mAllocLength = kAllocQuantum;
|
1999-03-05 20:55:10 +00:00
|
|
|
mString = new char[mAllocLength];
|
|
|
|
if (!mString)
|
|
|
|
{
|
1999-03-19 23:09:39 +00:00
|
|
|
mLastResult = NS_ERROR_OUT_OF_MEMORY;
|
1999-03-05 20:55:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
mConstString = mString;
|
|
|
|
*mString = '\0';
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
1999-08-10 23:00:53 +00:00
|
|
|
|
|
|
|
~CharImpl()
|
|
|
|
{
|
|
|
|
if (mString)
|
|
|
|
{
|
|
|
|
delete [] mString;
|
|
|
|
}
|
|
|
|
}
|
1999-03-05 20:55:10 +00:00
|
|
|
|
|
|
|
virtual PRInt32 write(const char* buf, PRUint32 aCount)
|
|
|
|
{
|
1999-06-10 19:51:36 +00:00
|
|
|
if (!buf)
|
|
|
|
return 0;
|
1999-03-05 20:55:10 +00:00
|
|
|
PRInt32 maxCount = mAllocLength - 1 - mOffset;
|
1999-03-19 23:09:39 +00:00
|
|
|
if ((PRInt32)aCount > maxCount)
|
1999-03-05 20:55:10 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
do {
|
|
|
|
maxCount += kAllocQuantum;
|
1999-03-19 23:09:39 +00:00
|
|
|
} while ((PRInt32)aCount > maxCount);
|
1999-03-05 20:55:10 +00:00
|
|
|
mAllocLength = maxCount + 1 + mOffset;
|
|
|
|
char* newString = new char[mAllocLength];
|
|
|
|
if (!newString)
|
|
|
|
{
|
1999-03-19 23:09:39 +00:00
|
|
|
mLastResult = NS_ERROR_OUT_OF_MEMORY;
|
1999-03-05 20:55:10 +00:00
|
|
|
return 0;
|
|
|
|
}
|
1999-06-10 19:51:36 +00:00
|
|
|
memcpy(newString, mString, mLength);
|
1999-03-05 20:55:10 +00:00
|
|
|
delete [] mString;
|
|
|
|
mString = newString;
|
|
|
|
mConstString = newString;
|
|
|
|
}
|
|
|
|
memcpy(mString + mOffset, buf, aCount);
|
|
|
|
mOffset += aCount;
|
|
|
|
if (mOffset > mOriginalLength)
|
|
|
|
mString[mOffset] = 0;
|
|
|
|
return aCount;
|
|
|
|
}
|
|
|
|
protected:
|
|
|
|
|
|
|
|
char*& mString;
|
|
|
|
size_t mAllocLength;
|
1999-03-19 23:09:39 +00:00
|
|
|
size_t mOriginalLength;
|
1999-03-05 20:55:10 +00:00
|
|
|
|
|
|
|
}; // class CharImpl
|
|
|
|
|
|
|
|
//========================================================================================
|
|
|
|
class ConstStringImpl
|
|
|
|
: public ConstCharImpl
|
|
|
|
//========================================================================================
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ConstStringImpl(const nsString& inString)
|
|
|
|
: ConstCharImpl(inString.ToNewCString())
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
~ConstStringImpl()
|
|
|
|
{
|
|
|
|
delete [] (char*)mConstString;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
}; // class ConstStringImpl
|
|
|
|
|
|
|
|
|
|
|
|
//========================================================================================
|
|
|
|
class StringImpl
|
|
|
|
: public ConstStringImpl
|
1999-06-10 19:51:36 +00:00
|
|
|
// This is wrong, since it really converts to 1-char strings.
|
1999-03-05 20:55:10 +00:00
|
|
|
//========================================================================================
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
StringImpl(nsString& inString)
|
|
|
|
: ConstStringImpl(inString)
|
|
|
|
, mString(inString)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual PRInt32 write(const char* buf, PRUint32 count)
|
|
|
|
{
|
1999-06-10 19:51:36 +00:00
|
|
|
if (!buf)
|
|
|
|
return 0;
|
1999-03-05 20:55:10 +00:00
|
|
|
// Clone our string as chars
|
|
|
|
char* cstring = mString.ToNewCString();
|
|
|
|
// Make a CharImpl and do the write
|
|
|
|
CharImpl chars(&cstring);
|
|
|
|
chars.Seek(PR_SEEK_SET, mOffset);
|
|
|
|
// Get the bytecount and result from the CharImpl
|
|
|
|
PRInt32 result = chars.write(buf,count);
|
1999-03-19 23:09:39 +00:00
|
|
|
mLastResult = chars.get_result();
|
1999-03-05 20:55:10 +00:00
|
|
|
// Set our string to match the new chars
|
|
|
|
mString = cstring;
|
|
|
|
// Set our const string also...
|
|
|
|
delete [] (char*)mConstString;
|
|
|
|
mConstString = cstring;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
protected:
|
|
|
|
|
|
|
|
nsString& mString;
|
|
|
|
|
|
|
|
}; // class StringImpl
|
|
|
|
|
|
|
|
NS_IMPL_RELEASE(BasicStringImpl)
|
|
|
|
NS_IMPL_ADDREF(BasicStringImpl)
|
|
|
|
|
1999-08-23 10:14:16 +00:00
|
|
|
NS_IMPL_QUERY_HEAD(BasicStringImpl)
|
|
|
|
NS_IMPL_QUERY_BODY(nsIRandomAccessStore)
|
|
|
|
NS_IMPL_QUERY_BODY(nsIOutputStream)
|
|
|
|
NS_IMPL_QUERY_BODY(nsIInputStream)
|
|
|
|
if ( aIID.Equals(NS_GET_IID(nsIBaseStream)) )
|
|
|
|
foundInterface = NS_STATIC_CAST(nsIBaseStream*, NS_STATIC_CAST(nsIOutputStream*, this));
|
|
|
|
else
|
|
|
|
NS_IMPL_QUERY_TAIL(nsIOutputStream)
|
1999-03-05 20:55:10 +00:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP BasicStringImpl::Seek(PRSeekWhence whence, PRInt32 offset)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
1999-03-19 23:09:39 +00:00
|
|
|
mLastResult = NS_OK; // reset on a seek.
|
1999-03-05 20:55:10 +00:00
|
|
|
mEOF = PR_FALSE; // reset on a seek.
|
|
|
|
PRInt32 fileSize = length();
|
1999-05-04 20:49:20 +00:00
|
|
|
PRInt32 newPosition=-1;
|
1999-03-05 20:55:10 +00:00
|
|
|
switch (whence)
|
|
|
|
{
|
|
|
|
case PR_SEEK_CUR: newPosition = mOffset + offset; break;
|
|
|
|
case PR_SEEK_SET: newPosition = offset; break;
|
|
|
|
case PR_SEEK_END: newPosition = fileSize + offset; break;
|
|
|
|
}
|
|
|
|
if (newPosition < 0)
|
|
|
|
{
|
|
|
|
newPosition = 0;
|
1999-03-19 23:09:39 +00:00
|
|
|
mLastResult = NS_FILE_RESULT(PR_FILE_SEEK_ERROR);
|
1999-03-05 20:55:10 +00:00
|
|
|
}
|
|
|
|
if (newPosition >= fileSize)
|
|
|
|
{
|
|
|
|
newPosition = fileSize;
|
|
|
|
mEOF = PR_TRUE;
|
|
|
|
}
|
|
|
|
mOffset = newPosition;
|
|
|
|
return NS_OK;
|
|
|
|
} // StringImpl::Seek
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-05-26 01:38:36 +00:00
|
|
|
extern "C" NS_COM nsresult NS_NewStringInputStream(
|
1999-03-05 20:55:10 +00:00
|
|
|
nsISupports** aStreamResult,
|
|
|
|
const nsString& aStringToRead)
|
|
|
|
// 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;
|
|
|
|
|
|
|
|
ConstStringImpl* stream = new ConstStringImpl(aStringToRead);
|
|
|
|
if (! stream)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
NS_ADDREF(stream);
|
|
|
|
*aStreamResult = (nsISupports*)(void*)stream;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-05-26 01:38:36 +00:00
|
|
|
extern "C" NS_COM nsresult NS_NewStringOutputStream(
|
1999-03-05 20:55:10 +00:00
|
|
|
nsISupports** aStreamResult,
|
|
|
|
nsString& aStringToChange)
|
|
|
|
// Factory method to get an nsOutputStream 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;
|
|
|
|
|
|
|
|
StringImpl* stream = new StringImpl(aStringToChange);
|
|
|
|
if (! stream)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
NS_ADDREF(stream);
|
|
|
|
*aStreamResult = (nsISupports*)(void*)stream;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-05-26 01:38:36 +00:00
|
|
|
extern "C" NS_COM nsresult NS_NewCharInputStream(
|
1999-03-05 20:55:10 +00:00
|
|
|
nsISupports** aStreamResult,
|
|
|
|
const char* aStringToRead)
|
|
|
|
// 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);
|
|
|
|
if (! stream)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
NS_ADDREF(stream);
|
|
|
|
*aStreamResult = (nsISupports*)(void*)stream;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-05-26 01:38:36 +00:00
|
|
|
extern "C" NS_COM nsresult NS_NewCharOutputStream(
|
1999-03-05 20:55:10 +00:00
|
|
|
nsISupports** aStreamResult,
|
|
|
|
char** aStringToChange)
|
|
|
|
// Factory method to get an nsOutputStream to a string. Result will implement all the
|
|
|
|
// file stream interfaces in nsIFileStream.h
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(aStreamResult != nsnull, "null ptr");
|
|
|
|
NS_PRECONDITION(aStringToChange != nsnull, "null ptr");
|
|
|
|
if (!aStreamResult || !aStringToChange)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
|
|
|
|
CharImpl* stream = new CharImpl(aStringToChange);
|
|
|
|
if (! stream)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
NS_ADDREF(stream);
|
|
|
|
*aStreamResult = (nsISupports*)(void*)stream;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-05-26 01:38:36 +00:00
|
|
|
extern "C" NS_COM nsresult NS_NewStringIOStream(
|
1999-03-05 20:55:10 +00:00
|
|
|
nsISupports** aStreamResult,
|
|
|
|
nsString& aStringToChange)
|
|
|
|
// Factory method to get an nsOutputStream to a string. Result will implement all the
|
|
|
|
// file stream interfaces in nsIFileStream.h
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
return NS_NewStringOutputStream(aStreamResult, aStringToChange);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-05-26 01:38:36 +00:00
|
|
|
extern "C" NS_COM nsresult NS_NewCharIOStream(
|
1999-03-05 20:55:10 +00:00
|
|
|
nsISupports** aStreamResult,
|
|
|
|
char** aStringToChange)
|
|
|
|
// Factory method to get an nsOutputStream to a string. Result will implement all the
|
|
|
|
// file stream interfaces in nsIFileStream.h
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
return NS_NewCharOutputStream(aStreamResult, aStringToChange);
|
|
|
|
}
|