Skip to content

Commit

Permalink
Merge pull request #218 from alyst/rdata_v3
Browse files Browse the repository at this point in the history
Support RData version 3 (default for R >= 3.5)
  • Loading branch information
SimonDanisch committed Jan 15, 2019
2 parents 471dde6 + 657c386 commit a676a5c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/registry.jl
Expand Up @@ -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

Expand Down

0 comments on commit a676a5c

Please sign in to comment.