@@ -147,7 +147,7 @@ show(io::IO, b::GenericIOBuffer) = print(io, "IOBuffer(data=UInt8[...], ",
147147
148148function unsafe_read (from:: GenericIOBuffer , p:: Ptr{UInt8} , nb:: UInt )
149149 from. readable || throw (ArgumentError (" read failed, IOBuffer is not readable" ))
150- avail = nb_available (from)
150+ avail = bytesavailable (from)
151151 adv = min (avail, nb)
152152 GC. @preserve from unsafe_copyto! (p, pointer (from. data, from. ptr), adv)
153153 from. ptr += adv
@@ -200,8 +200,8 @@ iswritable(io::GenericIOBuffer) = io.writable
200200
201201# TODO : GenericIOBuffer is not iterable, so doesn't really have a length.
202202# This should maybe be sizeof() instead.
203- # length(io::GenericIOBuffer) = (io.seekable ? io.size : nb_available (io))
204- nb_available (io:: GenericIOBuffer ) = io. size - io. ptr + 1
203+ # length(io::GenericIOBuffer) = (io.seekable ? io.size : bytesavailable (io))
204+ bytesavailable (io:: GenericIOBuffer ) = io. size - io. ptr + 1
205205position (io:: GenericIOBuffer ) = io. ptr- 1
206206
207207function skip (io:: GenericIOBuffer , n:: Integer )
@@ -251,10 +251,10 @@ function compact(io::GenericIOBuffer)
251251 if ismarked (io) && io. mark < io. ptr
252252 if io. mark == 0 return end
253253 ptr = io. mark
254- bytes_to_move = nb_available (io) + (io. ptr- io. mark)
254+ bytes_to_move = bytesavailable (io) + (io. ptr- io. mark)
255255 else
256256 ptr = io. ptr
257- bytes_to_move = nb_available (io)
257+ bytes_to_move = bytesavailable (io)
258258 end
259259 copyto! (io. data, 1 , io. data, ptr, bytes_to_move)
260260 io. size -= ptr - 1
@@ -305,7 +305,7 @@ eof(io::GenericIOBuffer) = (io.ptr-1 == io.size)
305305 nothing
306306end
307307
308- isopen (io:: GenericIOBuffer ) = io. readable || io. writable || io. seekable || nb_available (io) > 0
308+ isopen (io:: GenericIOBuffer ) = io. readable || io. writable || io. seekable || bytesavailable (io) > 0
309309
310310"""
311311 take!(b::IOBuffer)
@@ -330,7 +330,7 @@ function take!(io::GenericIOBuffer)
330330 nbytes = io. size
331331 data = copyto! (StringVector (nbytes), 1 , io. data, 1 , nbytes)
332332 else
333- nbytes = nb_available (io)
333+ nbytes = bytesavailable (io)
334334 data = read! (io,StringVector (nbytes))
335335 end
336336 if io. writable
@@ -351,7 +351,7 @@ function take!(io::IOBuffer)
351351 end
352352 resize! (data,io. size)
353353 else
354- nbytes = nb_available (io)
354+ nbytes = bytesavailable (io)
355355 a = StringVector (nbytes)
356356 data = read! (io, a)
357357 end
@@ -367,7 +367,7 @@ function write(to::GenericIOBuffer, from::GenericIOBuffer)
367367 from. ptr = from. size + 1
368368 return 0
369369 end
370- written:: Int = write_sub (to, from. data, from. ptr, nb_available (from))
370+ written:: Int = write_sub (to, from. data, from. ptr, bytesavailable (from))
371371 from. ptr += written
372372 return written
373373end
@@ -415,20 +415,20 @@ end
415415
416416readbytes! (io:: GenericIOBuffer , b:: Array{UInt8} , nb= length (b)) = readbytes! (io, b, Int (nb))
417417function readbytes! (io:: GenericIOBuffer , b:: Array{UInt8} , nb:: Int )
418- nr = min (nb, nb_available (io))
418+ nr = min (nb, bytesavailable (io))
419419 if length (b) < nr
420420 resize! (b, nr)
421421 end
422422 read_sub (io, b, 1 , nr)
423423 return nr
424424end
425- read (io:: GenericIOBuffer ) = read! (io,StringVector (nb_available (io)))
425+ read (io:: GenericIOBuffer ) = read! (io,StringVector (bytesavailable (io)))
426426readavailable (io:: GenericIOBuffer ) = read (io)
427- read (io:: GenericIOBuffer , nb:: Integer ) = read! (io,StringVector (min (nb, nb_available (io))))
427+ read (io:: GenericIOBuffer , nb:: Integer ) = read! (io,StringVector (min (nb, bytesavailable (io))))
428428
429429function findfirst (delim:: EqualTo{UInt8} , buf:: IOBuffer )
430430 p = pointer (buf. data, buf. ptr)
431- q = GC. @preserve buf ccall (:memchr ,Ptr{UInt8},(Ptr{UInt8},Int32,Csize_t),p,delim. x,nb_available (buf))
431+ q = GC. @preserve buf ccall (:memchr ,Ptr{UInt8},(Ptr{UInt8},Int32,Csize_t),p,delim. x,bytesavailable (buf))
432432 q == C_NULL && return nothing
433433 return Int (q- p+ 1 )
434434end
@@ -472,10 +472,10 @@ end
472472function _crc32c (io:: IOBuffer , nb:: Integer , crc:: UInt32 = 0x00000000 )
473473 nb < 0 && throw (ArgumentError (" number of bytes to checksum must be ≥ 0" ))
474474 io. readable || throw (ArgumentError (" read failed, IOBuffer is not readable" ))
475- n = min (nb, nb_available (io))
475+ n = min (nb, bytesavailable (io))
476476 n == 0 && return crc
477477 crc = GC. @preserve io unsafe_crc32c (pointer (io. data, io. ptr), n, crc)
478478 io. ptr += n
479479 return crc
480480end
481- _crc32c (io:: IOBuffer , crc:: UInt32 = 0x00000000 ) = _crc32c (io, nb_available (io), crc)
481+ _crc32c (io:: IOBuffer , crc:: UInt32 = 0x00000000 ) = _crc32c (io, bytesavailable (io), crc)
0 commit comments