From f1cf6d987cc495d7e0c76af2ffe4803994a87708 Mon Sep 17 00:00:00 2001 From: kshyatt Date: Tue, 2 Aug 2016 09:23:59 -0700 Subject: [PATCH] Fix #17070, make keyword arg docs of read more accurate, move docs out of HelpDB too. Fixed the type signatures. Made `nb` reflect what's actually in the code. --- base/docs/helpdb/Base.jl | 12 ------------ base/iostream.jl | 10 ++++++++++ doc/stdlib/io-network.rst | 4 ++-- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/base/docs/helpdb/Base.jl b/base/docs/helpdb/Base.jl index b678eef80e9f6..96b5e4886d85c 100644 --- a/base/docs/helpdb/Base.jl +++ b/base/docs/helpdb/Base.jl @@ -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 diff --git a/base/iostream.jl b/base/iostream.jl index bd675c345b75c..2ad0b41d492fa 100644 --- a/base/iostream.jl +++ b/base/iostream.jl @@ -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) diff --git a/doc/stdlib/io-network.rst b/doc/stdlib/io-network.rst index cb1ecfdb361c8..97e8c7c0c286a 100644 --- a/doc/stdlib/io-network.rst +++ b/doc/stdlib/io-network.rst @@ -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.