File: saveRDS.R

package info (click to toggle)
r-bioc-biocgenerics 0.52.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 772 kB
  • sloc: makefile: 2
file content (25 lines) | stat: -rw-r--r-- 1,046 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
### =========================================================================
### The saveRDS() generic
### -------------------------------------------------------------------------
###
### Need to explicitly define this generic otherwise the implicit generic
### in package "base" would dispatch on all its argument ('object', 'file',
### 'ascii', etc...). Here we set dispatch on the 1st arg (the 'object' arg)
### only!

setGeneric("saveRDS", signature="object")

### Note that this overwrites base::saveRDS()!
setMethod("saveRDS", "ANY",
    function(object, file="", ascii=FALSE, version=NULL,
             compress=TRUE, refhook=NULL)
    {
        ## Only a warning for now. Should we make this an error?
        if (containsOutOfMemoryData(object))
            warning("Object contains out-of-memory data so cannot be ",
                    "serialized reliably.\n  See '?containsOutOfMemoryData'.")
        base::saveRDS(object, file=file, ascii=ascii, version=version,
                      compress=compress, refhook=refhook)
    }
)