-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
ioInvolving the I/O subsystem: libuv, read, write, etc.Involving the I/O subsystem: libuv, read, write, etc.
Description
mark/reset works for IOBuffer:
julia> io = IOBuffer(UInt8[1,2,3])
julia> mark(io)
julia> readavailable(io) == [1,2,3]
true
julia> reset(io)
julia> readavailable(io) == [1,2,3]
true... but not for BufferStream:
Version 0.7.0-DEV.2098 (2017-10-10 11:37 UTC)
julia> io = BufferStream()
julia> write(io, UInt8[1,2,3])
julia> mark(io)
julia> readavailable(io) == [1,2,3]
true
julia> reset(io)
ERROR: ArgumentError: Base.GenericIOBuffer{Array{UInt8,1}} not marked
@which readavailable(io)
readavailable(this::Base.LibuvStream) in Base at stream.jl:780I think this is because readavailable(::Base.LibuvStream) calls take! (and take! does unmark).
See also pervious question about why the code has BufferStream <: LibuvStream but the comments says BufferStream <: IO.
If I cheat and read from io.buffer it works...
julia> io = BufferStream()
julia> write(io, UInt8[1,2,3])
julia> mark(io)
julia> readavailable(io.buffer) == [1,2,3]
true
julia> reset(io)
julia> readavailable(io.buffer) == [1,2,3]
trueMetadata
Metadata
Assignees
Labels
ioInvolving the I/O subsystem: libuv, read, write, etc.Involving the I/O subsystem: libuv, read, write, etc.