#include "config.h"
#include "BlobStream.h"
#include "ResourceHandle.h"
using BlackBerry::Platform::FilterStream;
namespace WebCore {
BlobStream::BlobStream(const ResourceResponse& response, ResourceHandle* handle)
: FilterStream()
, m_response(response)
{
registerStreamId();
handle->setClient(this);
}
BlobStream::~BlobStream()
{
}
void BlobStream::didReceiveData(ResourceHandle*, const char* data, int len, int)
{
notifyDataReceived(BlackBerry::Platform::createNetworkBufferByWrappingData(data, len));
}
void BlobStream::didFinishLoading(ResourceHandle*, double)
{
notifyClose(FilterStream::StatusSuccess);
}
void BlobStream::didFail(ResourceHandle*, const ResourceError&)
{
notifyClose(FilterStream::StatusErrorIO);
}
BlackBerry::Platform::String BlobStream::url() const
{
return m_response.url().string();
}
const BlackBerry::Platform::String BlobStream::mimeType() const
{
return m_response.mimeType();
}
}