|
1 | 1 | # nocov start |
2 | 2 | # S3 generic that returns a function to open connections in binary mode |
3 | | -connection_opener = function(con, ...) { |
4 | | - UseMethod("connection_opener") |
| 3 | +binary_reopener = function(con, ...) { |
| 4 | + UseMethod("binary_reopener") |
5 | 5 | } |
6 | 6 |
|
7 | | -connection_opener.default = function(con, ...) { |
| 7 | +binary_reopener.default = function(con, ...) { |
8 | 8 | con_class = class1(con) |
9 | 9 | stopf("Don't know how to reopen connection type '%s'. Need a connection opened in binary mode to continue.", con_class) |
10 | 10 | } |
11 | 11 |
|
12 | | -connection_opener.file = function(con, ...) { |
| 12 | +binary_reopener.file = function(con, ...) { |
13 | 13 | function(description) file(description, "rb", ...) |
14 | 14 | } |
15 | 15 |
|
16 | | -connection_opener.gzfile = function(con, ...) { |
| 16 | +binary_reopener.gzfile = function(con, ...) { |
17 | 17 | function(description) gzfile(description, "rb", ...) |
18 | 18 | } |
19 | 19 |
|
20 | | -connection_opener.bzfile = function(con, ...) { |
| 20 | +binary_reopener.bzfile = function(con, ...) { |
21 | 21 | function(description) bzfile(description, "rb", ...) |
22 | 22 | } |
23 | 23 |
|
24 | | -connection_opener.url = function(con, ...) { |
| 24 | +binary_reopener.url = function(con, ...) { |
25 | 25 | function(description) url(description, "rb", ...) |
26 | 26 | } |
27 | 27 |
|
28 | | -connection_opener.unz = function(con, ...) { |
| 28 | +binary_reopener.unz = function(con, ...) { |
29 | 29 | function(description) unz(description, "rb", ...) |
30 | 30 | } |
31 | 31 |
|
32 | | -connection_opener.pipe = function(con, ...) { |
| 32 | +binary_reopener.pipe = function(con, ...) { |
33 | 33 | function(description) pipe(description, "rb", ...) |
34 | 34 | } |
35 | 35 | # nocov end |
@@ -146,7 +146,7 @@ yaml=FALSE, tmpdir=tempdir(), tz="UTC") |
146 | 146 |
|
147 | 147 | if (needs_reopen) { |
148 | 148 | close(input) |
149 | | - input = connection_opener(input)(con_summary$description) |
| 149 | + input = binary_reopener(input)(con_summary$description) |
150 | 150 | close_con = input |
151 | 151 | } else if (!con_open) { |
152 | 152 | open(input, "rb") |
|
0 commit comments