-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serialization to an already open IOStream #304
Comments
Hi @fredrikekre , in principle that might be possible.
This works, because JLD2 does not do anything to the io when just opening a new file. More relevant: What do you want to achieve? JLD2 and the underlying HDF5 standard are designed around the fact that they control their files. In particular, JLD2 will do The HDF5-standard allows files to start at 0, 512, 1024, 2048, .... but only 512 is currently implemented for JLD2. (This could in principle be expanded). |
Just referencing stuff: |
Thanks. I am not very familiar with the HDF5 spec so maybe this is not possible in general. I tried some similar hack: function JLD2.jldopen(io::IO, mode::String)
@assert mode == "w"
f = JLD2.JLDFile(io, "dummy", true, false, false, false)
f.root_group = JLD2.Group{typeof(f)}(f)
f.types_group = JLD2.Group{typeof(f)}(f)
return f
end which works but only(?) for I wanted to use it for something like using JLD2, CodecZlib
open(GzipCompressorStream, "f.jld2.gz", "w") do io
jldopen(io) do jld
write(jld, ...)
end
end but such a stream is not seekable so will error on I guess it could be made to work if JLD2 allocated an in-memory seekable buffer and only actually wrote to the user specified IO when done (if that would be allowed by the spec). |
Ah, ok. Anything is allowed as long as you don't get caught.. |
JLD2 internally dispatches a lot on |
Yea, I just had a case where I store many non-isbits things (
Right. Does it
Yea, will probably do that.
Yea I think my hack will work as long as the Anyway, feel free to close this as a duplicate of the issues you linked above. |
I believe this is closed since #57 is closed |
#535 and therefore
Accepting an IOStream would also be possible. The only thing missing is a bit of API.
|
Would it be possible to write to a user provided IO? I skimmed through the signatures of
jldopen
but I think all of them expects a string. Would make things like this (contrived) example possible:The text was updated successfully, but these errors were encountered: