new readbytes and readbytes! functions #3878

merged 1 commit into from Jul 30, 2013


None yet
4 participants

stevengj commented Jul 30, 2013

This pull request expands the functionality of the (internal) readbytes functions that we already had into two new (exported & documented) functions (inspired by the functionality in Python's RawIOBase class):

readbytes!(stream, buffer::Vector{Uint8}, nb=length(buffer))
readbytes(stream, nb=typemax(Int))

The readbytes! function reads up to nb bytes into buffer (growing it as needed), returning the number of bytes read. The readbytes function reads up to nb bytes and returns a new Vector{Uint8} buffer containing the bytes read.

(Incidentally, we had two different implementations of readall(s::IO), one replacing the other; I kept the one that uses readbytes.)

PS. I added this functionality to make it easier for PyCall to pass Julia IO objects as the corresponding types in Python.

@stevengj stevengj added a commit to JuliaPy/PyCall.jl that referenced this pull request Jul 30, 2013

@stevengj stevengj conversion of Julia IO objects -> Python IOBase objects; RawIOBase fu…
…nctionality pending JuliaLang/julia#3878

stevengj referenced this pull request in JuliaLang/IJulia.jl Jul 30, 2013


display hooks for matplotlib #15

Keno merged commit f68dac1 into JuliaLang:master Jul 30, 2013

1 check passed

default The Travis CI build passed

err is not defined here.


samoconnor commented on base/fs.jl in c43ffb6 Jan 10, 2016

@stevengj, Is line 175 is an exact duplicate of line 178?


stevengj replied Jan 12, 2016

whoops, looks like it! feel free to patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment