From 657c3869ec5bf2bf4b0b5d44e13462bcb6627902 Mon Sep 17 00:00:00 2001 From: Alexey Stukalov Date: Sun, 13 Jan 2019 20:49:04 +0100 Subject: [PATCH] support RData version 3 (default for R >= 3.5) --- src/registry.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/registry.jl b/src/registry.jl index e8437e39..4f9cb5d3 100644 --- a/src/registry.jl +++ b/src/registry.jl @@ -6,13 +6,13 @@ add_format(format"JLD", (unsafe_wrap(Vector{UInt8}, "Julia data file (HDF5), ver add_format(format"JLD2", "Julia data file (HDF5), version 0.2", ".jld2", [:JLD2]) add_format(format"GZIP", [0x1f, 0x8b], ".gz", [:Libz]) -# test for RD?2 magic sequence at the beginning of R data input stream +# test for RD?n magic sequence at the beginning of R data input stream function detect_rdata(io) seekstart(io) read(io, UInt8) == UInt8('R') && read(io, UInt8) == UInt8('D') && read(io, UInt8) in (UInt8('A'), UInt8('B'), UInt8('X')) && - read(io, UInt8) == UInt8('2') && + read(io, UInt8) in (UInt8('2'), UInt8('3')) && (c = read(io, UInt8); c == UInt8('\n') || (c == UInt8('\r') && read(io, UInt8) == UInt8('\n'))) end