IO type that wraps an AbstractVector{UInt8}?

Besides IOBuffer, which doesn’t support all AbstractVector{UInt8}, is there an existing package with a type that wraps a vector of bytes as a read-only seekable IO?

What type do you want to support?

You can construct an IOBuffer from an arbitrary AbstractVector{UInt8}, but the default read method requires the array to support pointer.

In principle, if you had a particular array type you wanted to support, you could define your own read method. I agree that it would be nice to make this more generic in Base, but up to now there hasn’t been much demand.

I want to support all AbstractVector{UInt8} for use in ZipArchives.jl

In that case, I want to be able to open an IO view of an entry in a zip archive in a vector of bytes that the user provides.

I made an issue for that `GenericIOBuffer` assumes data is stored contiguously in memory · Issue #54636 · JuliaLang/julia · GitHub

I made a package for this type.

1 Like