You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use readbytes! with FIFOBuffer but I'm encountering errors since read(::FIFOBuffer, ::Type{UInt8}) returns a Tuple{UInt8,Bool} rather than the typical UInt8.
julia>using HTTP
julia> f = HTTP.FIFOBuffer(5);
julia> b =Array{UInt8}(3);
julia>write(f, [0x01, 0x02, 0x03, 0x04, 0x05])
5
julia>readbytes!(f, b)
ERROR: MethodError: Cannot `convert` an object of type Tuple{UInt8,Bool} to an object of type UInt8
This may have arisen from a call to the constructor UInt8(...),
since type constructors fall back to convert methods.
inreadbytes!(::HTTP.FIFOBuffer, ::Array{UInt8,1}, ::Int64) at ./io.jl:351inreadbytes!(::HTTP.FIFOBuffer, ::Array{UInt8,1}) at ./io.jl:342
julia> io =IOBuffer([0x01, 0x02, 0x03, 0x04, 0x05])
IOBuffer(data=UInt8[...], readable=true, writable=false, seekable=true, append=false, size=5, maxsize=Inf, ptr=1, mark=-1)
julia>readbytes!(io, b)
3
Could you use a different function name for this behaviour if it is required?
The text was updated successfully, but these errors were encountered:
Yeah, it'd probably be better to call it something different. It started out returning like normal, but then I realized I needed to return more, but kept the function name the same.
I'm trying to use
readbytes!
withFIFOBuffer
but I'm encountering errors sinceread(::FIFOBuffer, ::Type{UInt8})
returns aTuple{UInt8,Bool}
rather than the typicalUInt8
.Could you use a different function name for this behaviour if it is required?
The text was updated successfully, but these errors were encountered: