Learn R Programming

TSON

R implementation of TSON specification.

Note

Type int64 is not yet implemented.

Changes

1.3

  • overcome readBin/writeBin character limit (10 kbytes)

1.2

  • use of connection object : overall performance should be improved
  • new function writeTSON : Write TSON specification binary-encoded format to a connection.
  • new function readTSON : Read TSON specification binary-encoded format from a connection.

1.1

  • package now export tson.scalar
  • tson.scalar, tson.character ... return NULL if given object is NULL
  • values can be NULL in maps
  • correct endianess for readBin

Example

library(rtson)

list = list(integer=42L,
          double=42,
          bool=TRUE,
          uint8=tson.uint8.vec(c(42,0)),
          uint16=tson.uint16.vec(c(42,0)),
          uint32=tson.uint32.vec(c(42,0)),
          int8=tson.int8.vec(c(42,0)),
          int16=tson.int16.vec(c(42,0)),
          int32=as.integer(c(42,0)),
          float32=tson.float32.vec(c(0.0, 42.0)),
          float64=c(42.0,42.0),
          map=list(x=42, y=42, label="42"),
          list=list("42",42)
)

bytes = toTSON(list)

print(as.integer(bytes))

object = fromTSON(bytes)

print(object)

Copy Link

Version

Install

install.packages('rtson')

Monthly Downloads

178

Version

1.3

License

Apache License Version 2.0

Issues

Pull Requests

Stars

Forks

Maintainer

Alexandre Maurel

Last Published

August 26th, 2016

Functions in rtson (1.3)

tson.map

Make a tson map
tson.int

Make a tson integer
tson.int8.vec

Make a tson int8 vector
tson.int16.vec

Make a tson int16 vector
readTSON

Deserialize a connection
fromTSON

Deserialize a raw vector
tson.float32.vec

Make a tson float32 vector
tson.double

Make a tson double
tson.character

Make a tson character
toTSON

Serialize a list
tson.uint32.vec

Make a tson uint32 vector
tson.scalar

Make a tson scalar (ie: singleton)
writeTSON

Serialize a list
tson.uint16.vec

Make a tson uint16 vector
tson.uint8.vec

Make a tson uint8 vector