read-methods(RProtoBuf)
read-methods()所属R语言包:RProtoBuf
Read a protocol buffer message from a connection
连接的协议缓冲区消息
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Read a Message from a connection using its associated Descriptor
阅读邮件从连接使用相关的描述
方法----------Methods----------
signature(descriptor = "Descriptor", input = "character") Read the message from a file
signature(descriptor = "Descriptor", input = "character")阅读信息从一个文件
signature(descriptor = "Descriptor") Read from a binary connection.
signature(descriptor = "Descriptor")读取的二进制连接。
signature(descriptor = "Descriptor", input = "raw") Read the message from a raw vector
signature(descriptor = "Descriptor", input = "raw")阅读信息从原始向量
实例----------Examples----------
# example file that contains a "tutorial.AddressBook" message[例如文件,其中包含的“tutorial.AddressBook”消息]
book <- system.file( "examples", "addressbook.pb", package = "RProtoBuf" )
# read the message[阅读邮件]
message <- read( tutorial.AddressBook, book )
# or using the pseudo method [或使用的伪法]
message <- tutorial.AddressBook$read( book )
# write its debug string[写调试字符串]
writeLines( as.character( message ) )
# grab the name of each person[抓住每个人的名字]
sapply( message$person, function(p) p$name )
# read from a binary file connection[从二进制文件连接读取]
f <- file( book, open = "rb" )
message2 <- read( tutorial.AddressBook, f )
close( f )
# read from a message payload (raw vector)[读取一个消息有效负载(原始矢量)]
payload <- readBin( book, raw(0), 5000 )
message3 <- tutorial.AddressBook$read( payload )
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|