When I enter the following in REPL,
using Serialization
buffer = IOBuffer()
serialize(buffer, [1,2,3])
deserialize(buffer)
I get this error:
ERROR: EOFError: read end of file
Stacktrace:
[1] read
@ ./iobuffer.jl:217 [inlined]
[2] deserialize
@ /build/julia/src/julia-1.6.1/usr/share/julia/stdlib/v1.6/Serialization/src/Serialization.jl:782 [inlined]
[3] deserialize(s::IOBuffer)
@ Serialization /build/julia/src/julia-1.6.1/usr/share/julia/stdlib/v1.6/Serialization/src/Serialization.jl:769
[4] top-level scope
@ REPL[4]:1
and the documentation does not help me much: Serialization · The Julia Language
I can test that something has been written:
julia> serialize(buffer, [1,2,3])
24
julia> String(take!(buffer))
"7JL\r\x04\0\0\0\x15\0\b\xe2\x01\0\0\0\0\0\0\0\x02\0\0\0\0\0\0\0\x03\0\0\0\0\0\0\0"
What am I doing wrong?