Use the following code for reference, In tizen we are getting the response as chunks of data, As you said 15559 bytes is an reference data. So you should collect the bytebuffer data until you get the whole data.
Code description:
keep the bytebuffer as class variable (here _pBuff
)
_hasData
is a flag which is set once the buffer has data (Then you need to append data)
Once you get the whole data clear the _pbuff
void YourClass::OnTransactionReadyToRead(HttpSession& httpSession,
HttpTransaction& httpTransaction, int availableBodyLen) {
AppLog("Transaction Ready to Read : availableBodyLen %d", availableBodyLen);
try {
HttpResponse* pHttpResponse = null;
HttpHeader* pHttpHeader = null;
pHttpResponse = httpTransaction.GetResponse();
if (pHttpResponse->GetHttpStatusCode() == HTTP_STATUS_OK) {
bool _hasData = false;
if (!_pBuff) {
_pBuff = new ByteBuffer;
_pBuff->Construct(availableBodyLen);
}
else
{
_pBuff->ExpandCapacity(_pBuff->GetCapacity() + availableBodyLen);
_hasData = true;
}
pHttpHeader = pHttpResponse->GetHeader();
if(_hasData)
{
ByteBuffer* pBody = pHttpResponse->ReadBodyN();
// add to local store
byte* pByte = new byte[availableBodyLen];
pBody->GetArray(pByte,0,availableBodyLen);
_pBuff->SetPosition(_pBuff->GetCapacity() - availableBodyLen);
_pBuff->SetArray(pByte,0,availableBodyLen);
delete []pByte;
delete pBody;
}
else
_pBuff = pHttpResponse->ReadBodyN();
// Your Call || code
}
}