Is this possible? I've tried both writeChar() and writeBin() to no avail. My goal is to serialize(ascii=FALSE) an object to a connection but determine the size of the serialized object before hand:
sobject <- serialize(object,NULL,ascii=FALSE) len <- nchar(sobject) # # run some code here to notify listener on other end of connection # how many bytes I'm getting ready to send # writeChar(sobject,con) The other option is to serialize twice: len <- nchar(serialize(object,NULL,ascii=FALSE)) # # run some code here to notify listener on other end of connection # how many bytes I'm getting ready to send # serialize(object,con,ascii=FALSE) Object stores, like memcache (http://danga.com/memcached/), need to know object sizes before storing. RDBMS's which support large objects (CLOBS or BLOBS) don't nececarilly need to know object sizes before-hand, but they do have max column size limits which must be honored. BTW, readchar() can read strings with embedded nulls; I figured writeChar() should be able to write them. -- Jeffrey Horner Computer Systems Analyst School of Medicine 615-322-8606 Department of Biostatistics Vanderbilt University ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel