binary_reopener {data.table}R Documentation

Create a function to open connections in binary mode

Description

S3 generic that returns a function to open a connection in binary read mode. Used internally by fread. Exported so packages with custom connection classes can define methods.

Usage

binary_reopener(con, ...)

Arguments

con

A connection object.

...

Additional arguments passed to the connection constructor.

Details

Returns a function that accepts a description argument and opens a connection in binary read mode ("rb"). Methods are provided for file, gzfile, bzfile, url, unz and pipe connections.

To support custom connection types with fread, define a method for your connection class that returns an opener function.

Value

A function that accepts a description argument and returns a connection object opened in binary read mode.

See Also

fread

Examples

## Not run: 
# Define a method for a custom connection class
binary_reopener.my_con = function(con, ...) {
  function(description) my_con(description, mode = "rb", ...)
}

## End(Not run)

[Package data.table version 1.18.99 Index]