Skip to content

Commit

Permalink
Fix #17070, make keyword arg docs of read more accurate, move docs ou…
Browse files Browse the repository at this point in the history
…t of HelpDB too.

Fixed the type signatures. Made `nb` reflect what's actually in the
code.
  • Loading branch information
kshyatt committed Aug 3, 2016
1 parent 328b561 commit f1cf6d9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
12 changes: 0 additions & 12 deletions base/docs/helpdb/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8761,18 +8761,6 @@ Letter: Lowercase.
"""
islower

"""
read(stream::IO, nb=typemax(Int); all=true)
Read at most `nb` bytes from `stream`, returning a `Vector{UInt8}` of the bytes read.
If `all` is `true` (the default), this function will block repeatedly trying to read all
requested bytes, until an error or end-of-file occurs. If `all` is `false`, at most one
`read` call is performed, and the amount of data returned is device-dependent. Note that not
all stream types support the `all` option.
"""
read

"""
eig(A,[irange,][vl,][vu,][permute=true,][scale=true]) -> D, V
Expand Down
10 changes: 10 additions & 0 deletions base/iostream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,16 @@ function read(s::IOStream)
resize!(b, nr)
end

"""
read(s::IOStream, nb::Integer; all=true)
Read at most `nb` bytes from `s`, returning a `Vector{UInt8}` of the bytes read.
If `all` is `true` (the default), this function will block repeatedly trying to read all
requested bytes, until an error or end-of-file occurs. If `all` is `false`, at most one
`read` call is performed, and the amount of data returned is device-dependent. Note that not
all stream types support the `all` option.
"""
function read(s::IOStream, nb::Integer; all::Bool=true)
b = Array{UInt8}(nb)
nr = readbytes!(s, b, nb, all=all)
Expand Down
4 changes: 2 additions & 2 deletions doc/stdlib/io-network.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,11 @@ General I/O

See ``read`` for a description of the ``all`` option.

.. function:: read(stream::IO, nb=typemax(Int); all=true)
.. function:: read(s::IOStream, nb::Integer; all=true)

.. Docstring generated from Julia source
Read at most ``nb`` bytes from ``stream``\ , returning a ``Vector{UInt8}`` of the bytes read.
Read at most ``nb`` bytes from ``s``\ , returning a ``Vector{UInt8}`` of the bytes read.

If ``all`` is ``true`` (the default), this function will block repeatedly trying to read all requested bytes, until an error or end-of-file occurs. If ``all`` is ``false``\ , at most one ``read`` call is performed, and the amount of data returned is device-dependent. Note that not all stream types support the ``all`` option.

Expand Down

0 comments on commit f1cf6d9

Please sign in to comment.