我想使用azure存储SDK将uint8_t数组上传到azure存储。我正在努力构建来自数组的输入流,我设法通过使用std :: vector进行编译,但需要额外的数组副本。
你认为有更好的方法吗?
void upload(azure::storage::cloud_blob_container container, const wchar_t* blobName, const uint8_t * data, size_t dataLength) {
std::vector<uint8_t> bytes(dataLength, (const unsigned char)data);
concurrency::streams::bytestream byteStream = concurrency::streams::bytestream();
concurrency::streams::istream inputStream = byteStream.open_istream(bytes);
const utility::string_t myBlobName(blobName);
azure::storage::cloud_block_blob blockBlob = container.get_block_blob_reference(myBlobName);
blockBlob.upload_from_stream(inputStream);
inputStream.close();
}
upload_from_stream方法需要concurrency :: streams :: istream,但我不知道如何从基本数组构造
提前谢谢
答案 0 :(得分:3)
我设法使用rawptr_buffer找到了更好的解决方案:
for line in sys.stdin:
print line