本文整理汇总了C++中MemoryBuffer::readDirect方法的典型用法代码示例。如果您正苦于以下问题:C++ MemoryBuffer::readDirect方法的具体用法?C++ MemoryBuffer::readDirect怎么用?C++ MemoryBuffer::readDirect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemoryBuffer
的用法示例。
在下文中一共展示了MemoryBuffer::readDirect方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LZMALZDecompressToBuffer
void LZMALZDecompressToBuffer(MemoryAttr & out, MemoryBuffer & in)
{
size32_t expsz;
size32_t cmpsz;
in.read(expsz).read(cmpsz);
void *o = out.allocate(expsz);
if (cmpsz!=expsz) {
CLZMA lzma;
size32_t written = lzma.expand(in.readDirect(cmpsz),cmpsz,o,expsz);
if (written!=expsz)
throw MakeStringException(0, "fastLZDecompressToBuffer - corrupt data(4) %d %d",written,expsz);
}
else
memcpy(o,in.readDirect(cmpsz),expsz);
}
示例2: aesDecryptWithRSAEncryptedKey
size32_t aesDecryptWithRSAEncryptedKey(MemoryBuffer &out, size32_t inSz, const void *inBytes, const CLoadedKey &privateKey)
{
MemoryBuffer in;
in.setBuffer(inSz, (void *)inBytes, false);
// read encrypted AES key
size32_t encryptedAESKeySz;
in.read(encryptedAESKeySz);
MemoryBuffer aesKey;
size32_t decryptedAesKeySz = privateKeyDecrypt(aesKey, encryptedAESKeySz, in.readDirect(encryptedAESKeySz), privateKey);
if (decryptedAesKeySz != aesMaxKeySize)
throw makeStringException(0, "aesDecryptWithRSAEncryptedKey - invalid input");
unsigned iVPos = in.getPos(); // read directly further down
in.skip(aesBlockSize);
size32_t aesEncryptedSz;
in.read(aesEncryptedSz);
return aesDecrypt(out, aesEncryptedSz, in.readDirect(aesEncryptedSz), aesMaxKeySize, (const char *)aesKey.bytes(), (const char *)in.bytes()+iVPos);
}
示例3: RowBlock
VariableRowBlock::VariableRowBlock(MemoryBuffer & inBuffer, __int64 _start) : RowBlock(_start, 0)
{
inBuffer.read(numRows);
for (unsigned row = 0; row < numRows; row++)
{
unsigned thisLength;
rowIndex.append(buffer.length());
inBuffer.read(thisLength);
buffer.append(thisLength, inBuffer.readDirect(thisLength));
}
rowIndex.append(buffer.length());
}
示例4: ThorExpand
size32_t ThorExpand(MemoryBuffer & src, MemoryBuffer & dest)
{
size32_t len = src.remaining();
const void *pSrc = src.readDirect(len);
return ThorExpand(pSrc, len, dest);
}
示例5: readResults
//.........这里部分代码省略.........
E->Release();
break;
}
if (!sendlen)
break;
}
else if (readBlocked)
socket->receive_block(t, len);
else
socket->read(t, len);
}
catch(IException * e)
{
pexception("failed to read data", e);
e->Release();
return 1;
}
if (pluginRequest)
{
//Not very robust! A poor man's implementation for testing...
StringBuffer dllname, libname;
const char * dot = strchr(t, '.');
dllname.append("\\edata\\bin\\debug\\").append(t);
libname.append("\\edata\\bin\\debug\\").append(dot-t,t).append(".lib");
sendFile(dllname.str(), socket);
sendFile(libname.str(), socket);
}
else if (dataBlockRequest)
{
//Not very robust! A poor man's implementation for testing...
offset_t offset;
mb.read(offset);
sendFileChunk((const char *)mb.readDirect(offset), offset, socket);
}
else if (remoteReadRequest)
{
Owned<IPropertyTree> requestTree = createPTreeFromJSONString(queryLen, query);
Owned<IPropertyTree> responseTree; // used if response is xml or json
const char *outputFmtStr = requestTree->queryProp("format");
const char *response = nullptr;
if (!outputFmtStr || strieq("xml", outputFmtStr))
{
response = (const char *)mb.readDirect(len);
responseTree.setown(createPTreeFromXMLString(len, response));
}
else if (strieq("json", outputFmtStr))
{
response = (const char *)mb.readDirect(len);
responseTree.setown(createPTreeFromJSONString(len, response));
}
unsigned cursorHandle;
if (responseTree)
cursorHandle = responseTree->getPropInt("cursor");
else
mb.read(cursorHandle);
bool retrySend = false;
if (cursorHandle)
{
PROGLOG("Got handle back: %u; len=%u", cursorHandle, len);
StringBuffer xml;
if (responseTree)
{
if (echoResults && response)
{
fputs(response, stdout);