本文整理汇总了C++中nsCOMPtr::AppendStream方法的典型用法代码示例。如果您正苦于以下问题:C++ nsCOMPtr::AppendStream方法的具体用法?C++ nsCOMPtr::AppendStream怎么用?C++ nsCOMPtr::AppendStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsCOMPtr
的用法示例。
在下文中一共展示了nsCOMPtr::AppendStream方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stream
PRBool
nsMIMEInputStream::Read(const IPC::Message *aMsg, void **aIter)
{
using IPC::ReadParam;
if (!ReadParam(aMsg, aIter, &mHeaders) ||
!ReadParam(aMsg, aIter, &mContentLength) ||
!ReadParam(aMsg, aIter, &mStartedReading))
return PR_FALSE;
// nsMIMEInputStream::Init() already appended mHeaderStream & mCLStream
mHeaderStream->ShareData(mHeaders.get(),
mStartedReading? mHeaders.Length() : 0);
mCLStream->ShareData(mContentLength.get(),
mStartedReading? mContentLength.Length() : 0);
IPC::InputStream inputStream;
if (!ReadParam(aMsg, aIter, &inputStream))
return PR_FALSE;
nsCOMPtr<nsIInputStream> stream(inputStream);
mData = stream;
if (stream) {
nsresult rv = mStream->AppendStream(mData);
if (NS_FAILED(rv))
return PR_FALSE;
}
if (!ReadParam(aMsg, aIter, &mAddContentLength))
return PR_FALSE;
return PR_TRUE;
}
示例2: Init
nsresult nsMIMEInputStream::Init()
{
nsresult rv = NS_OK;
mStream = do_CreateInstance("@mozilla.org/io/multiplex-input-stream;1",
&rv);
NS_ENSURE_SUCCESS(rv, rv);
mHeaderStream = do_CreateInstance("@mozilla.org/io/string-input-stream;1",
&rv);
NS_ENSURE_SUCCESS(rv, rv);
mCLStream = do_CreateInstance("@mozilla.org/io/string-input-stream;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = mStream->AppendStream(mHeaderStream);
NS_ENSURE_SUCCESS(rv, rv);
rv = mStream->AppendStream(mCLStream);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
示例3:
NS_IMETHODIMP
nsMIMEInputStream::SetData(nsIInputStream *aStream)
{
NS_ENSURE_FALSE(mStartedReading, NS_ERROR_FAILURE);
// Remove the old stream if there is one
if (mData)
mStream->RemoveStream(2);
mData = aStream;
if (aStream)
mStream->AppendStream(mData);
return NS_OK;
}
示例4: DeserializeInputStream
bool
nsMIMEInputStream::Deserialize(const InputStreamParams& aParams,
const FileDescriptorArray& aFileDescriptors)
{
if (aParams.type() != InputStreamParams::TMIMEInputStreamParams) {
NS_ERROR("Received unknown parameters from the other process!");
return false;
}
const MIMEInputStreamParams& params =
aParams.get_MIMEInputStreamParams();
const OptionalInputStreamParams& wrappedParams = params.optionalStream();
mHeaders = params.headers();
mContentLength = params.contentLength();
mStartedReading = params.startedReading();
// nsMIMEInputStream::Init() already appended mHeaderStream & mCLStream
mHeaderStream->ShareData(mHeaders.get(),
mStartedReading ? mHeaders.Length() : 0);
mCLStream->ShareData(mContentLength.get(),
mStartedReading ? mContentLength.Length() : 0);
nsCOMPtr<nsIInputStream> stream;
if (wrappedParams.type() == OptionalInputStreamParams::TInputStreamParams) {
stream = DeserializeInputStream(wrappedParams.get_InputStreamParams(),
aFileDescriptors);
if (!stream) {
NS_WARNING("Failed to deserialize wrapped stream!");
return false;
}
mData = stream;
if (NS_FAILED(mStream->AppendStream(mData))) {
NS_WARNING("Failed to append stream!");
return false;
}
}
else {
NS_ASSERTION(wrappedParams.type() == OptionalInputStreamParams::Tvoid_t,
"Unknown type for OptionalInputStreamParams!");
}
mAddContentLength = params.addContentLength();
return true;
}