jli  Linuxx86_641.10.3v1.10.30b4590a5507d3f3046e5bafc007cacbbfc9b310b(SimpleBufferStreamKTzw8P"\-6F/opt/julia/packages/SimpleBufferStream/N1BA4/src/SimpleBufferStream.jl?A@/opt/julia/packages/SimpleBufferStream/N1BA4/src/BufferStream.jl?ACoremуJ5Basemу]J5MainmуJ5ArgToolsBń x(mуF K5 Artifactsmr-V3|mу K5Base64UlD*_mу> K5CRC32c\y.jmуj K5 FileWatchingXzsy`{,zmуh& K5LibdluVW59˗,mу-" K5LoggingT{VhUXM=mуrU" K5MmapP~:xg,Omу|' K5NetworkOptionsC0YW,mуʠ, K5SHAQ<$!<%mу1 K5 Serialization [)*k1mу-G K5Sockets1V$ bdސݗmуYBY K5UnicodeP>I>Nrmуeszo K5 LinearAlgebraSm7̏mуuux K5 OpenBLAS_jll[(Śb6EcQ FmуDux K5libblastrampoline_jllLSۆ }lxӠmу^} K5MarkdownZPn7z`smу/Ed~ K5Printfg^cX׸QDmу;h K5Random_ɢ?\Ymу? K5TarOi>աmу!t, K5DatesEY8pj2 mуX K5FuturebS;3{I xVMmуsD K5InteractiveUtilsWL ~@'ZmуVg K5LibGit2Z[&RPTv3EКRmу8J K5 LibGit2_jll YXg}]$mуD K5 MbedTLS_jllAX 3ȡ_mу- K5 LibSSH2_jlloTZk)߆ bs.max_len throw(ArgumentError("Chunk is too large to fit into this BufferStream!")) end # Copy the data so that users can't clobber our internal list lock(bs.write_cond) do # If we would exceed our maximum length, then we must wait until someone reads from us. while bs.max_len != 0 && length(bs) + length(data) > bs.max_len wait(bs.write_cond) end push!(bs.chunks, data) end # Notify someone who was waiting for some data lock(bs.read_cond) do notify(bs.read_cond; all=false) end return length(data) end # Helper methods for read/write write(bs::BufferStream, x::UInt8) = write(bs, [x]) function unsafe_write(bs::BufferStream, ref::Ptr{UInt8}, nbytes::UInt) return append_chunk(bs, copy(unsafe_wrap(Array, ref, (nbytes,)))) end # Read a single byte. function read(bs::BufferStream, ::Type{UInt8}) data = UInt8[0] readbytes!(bs, data, 1) return data[1] end # Read everything function read(bs::BufferStream) ret = UInt8[] lock(bs.read_cond) do while !eof(bs) append!(ret, readavailable(bs)) end end return ret end # Completely consume the first chunk. function readavailable(bs::BufferStream) lock(bs.read_cond) do if isempty(bs.chunks) if !isopen(bs) return UInt8[] end wait(bs.read_cond) # Handle cancellation explicitly if isempty(bs.chunks) return UInt8[] end end # We're gonna consume the rest of this chunk local chunk lock(bs.write_cond) do chunk = popfirst!(bs.chunks) notify(bs.write_cond; all=false) end chunkview = view(chunk, bs.chunk_read_idx:length(chunk)) bs.chunk_read_idx = 1 return chunkview end end # Read up to `maxlen` bytes, potentially partially consuming the first chunk. function readbytes!(bs::BufferStream, data::Vector{UInt8}, maxlen::Int) lock(bs.read_cond) do if isempty(bs.chunks) if !isopen(bs) return 0 end wait(bs.read_cond) # Handle cancellation explicitly if isempty(bs.chunks) return 0 end end # Grab the first chunk that is available local chunk lock(bs.write_cond) do firstchunk = first(bs.chunks) # take view of only what we will read chunk = view(firstchunk, bs.chunk_read_idx:min(bs.chunk_read_idx + maxlen - 1,length(firstchunk))) # Update datastructure to consume the view we just took if maxlen > length(firstchunk) - bs.chunk_read_idx popfirst!(bs.chunks) bs.chunk_read_idx = 1 notify(bs.write_cond; all=false) else bs.chunk_read_idx += maxlen end end for idx in 1:length(chunk) data[idx] = chunk[idx] end return length(chunk) end end function skip(bs::BufferStream, n::Int) data = Array{UInt8}(undef, min(2*1024*1024, n)) while n > 0 n -= readbytes!(bs, data, min(length(data), n)) if eof(bs) break end end return n end F Ǻy