MongoDB C++ Driver
legacy-1.1.2
|
class which allow to build GridFiles in a stream fashion way More...
#include <gridfs.h>
Public Member Functions | |
GridFileBuilder (GridFS *const grid) | |
void | appendChunk (const char *data, size_t length) |
Appends a chunk of data. More... | |
mongo::BSONObj | buildFile (const std::string &remoteName, const std::string &contentType="") |
Inserts the description of the file in GridFS collection. More... | |
class which allow to build GridFiles in a stream fashion way
mongo::GridFileBuilder::GridFileBuilder | ( | GridFS *const | grid | ) |
grid | - gridfs instance |
void mongo::GridFileBuilder::appendChunk | ( | const char * | data, |
size_t | length | ||
) |
Appends a chunk of data.
Data will be split as many times as necessary in chunkSize blocks. Sizes not multiple of chunkSize will copy the reamining bytes to a pendingData pointer. In this way, it is possible to add data in a stream fashion way.
data | - C string with data |
length | - size of the string |
mongo::BSONObj mongo::GridFileBuilder::buildFile | ( | const std::string & | remoteName, |
const std::string & | contentType = "" |
||
) |
Inserts the description of the file in GridFS collection.
Note that the stream will be reinitialized after the build call, so it will be possible to continue appending data to build another file.
remoteName | filename to use for file stored in GridFS |
contentType | optional MIME type for this object. (default is to omit) |