mongo.gridfile.writer.create(rmongodb)
mongo.gridfile.writer.create()所属R语言包:rmongodb
Create a mongo.gridfile.writer object
创建一个mongo.gridfile.writer对象
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Create a mongo.gridfile.writer object used to buffer many writes to a single GridFS file. Once the mongo.gridfile.writer is created, use mongo.gridfile.writer.write() to write data to the buffered GridFS file and mongo.gridfile.writer.finish() when done.
创建一个用于缓冲许多写入到一个单一的GridFS文件mongo.gridfile.writer对象。一旦mongo.gridfile.writer创建,使用mongo.gridfile.writer.write()将数据写入缓冲的GridFS文件和mongo.gridfile.writer.finish()完成。
用法----------Usage----------
mongo.gridfile.writer.create(gridfs, remotename, contenttype="")
参数----------Arguments----------
参数:gridfs
A (mongo.gridfs) object.
A(mongo.gridfs)的对象。
参数:remotename
(string) The name the file will be known as within the GridFS.
(字符串)的名称,该文件将被称为内GridFS。
参数:contenttype
(string) Optional MIME content type.
(字符串)可选的MIME内容类型。
值----------Value----------
(mongo.gridfile.writer) The object to be used for writing to the GridFS file.
(mongo.gridfile.writer)对象物的用于写入的GridFS文件。
参见----------See Also----------
mongo.gridfs,<br> mongo.gridfs.create,<br> mongo.gridfile.writer.write,<br> mongo.gridfile.writer.finish.
mongo.gridfs,参考mongo.gridfs.create,参考mongo.gridfile.writer.write,参考mongo.gridfile.writer.finish。
实例----------Examples----------
mongo <- mongo.create()
if (mongo.is.connected(mongo)) {
gridfs <- mongo.gridfs.create(mongo, "grid")
gfw <- mongo.gridfile.writer.create(gridfs, "test.dat")
# store 4 bytes[存储4个字节]
mongo.gridfile.writer.write(gfw, charToRaw("test"))
# store string & LF plus 0-byte terminator[存储串LF加0字节终止]
buf <- writeBin("Test\n", as.raw(1))
mongo.gridfile.writer.write(gfw, buf)
# store PI as a float[存储PI为float]
buf <- writeBin(3.1415926, as.raw(1), size=4, endian="little")
mongo.gridfile.writer.write(gfw, buf)
mongo.gridfile.writer.finish(gfw)
mongo.gridfs.destroy(gridfs)
}
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|