read-methods | R Documentation |
Read a Message from a connection using its associated Descriptor
signature(descriptor = "Descriptor", input = "character")
Read the message from a file
signature(descriptor = "Descriptor")
Read from a binary connection.
signature(descriptor = "Descriptor", input = "raw")
Read the message from a raw vector
# example file that contains a "tutorial.AddressBook" message 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 )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.