Skip to content

Commit

Permalink
add misc touch-ups to IOBuffer (JuliaLang#25919)
Browse files Browse the repository at this point in the history
  • Loading branch information
bicycle1885 authored and JeffBezanson committed Feb 7, 2018
1 parent e879820 commit 2ca63e1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,10 @@ Deprecated or removed

* The unexported type `AbstractIOBuffer` has been renamed to `GenericIOBuffer` ([#17360] [#22796]).

* `IOBuffer(data::AbstractVector{UInt8}, read::Bool, write::Bool, maxsize::Integer)`,
`IOBuffer(read::Bool, write::Bool)`, and `IOBuffer(maxsize::Integer)` are
deprecated in favor of constructors taking keyword arguments ([#25872]).

* `Display` has been renamed to `AbstractDisplay` ([#24831]).

* Remaining vectorized methods over `SparseVector`s, particularly `floor`, `ceil`,
Expand Down
11 changes: 7 additions & 4 deletions base/iobuffer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ julia> write(io, "JuliaLang is a GitHub organization.", " It has many members.")
julia> String(take!(io))
"JuliaLang is a GitHub organization. It has many members."
julia> io = IOBuffer("JuliaLang is a GitHub organization.")
julia> io = IOBuffer(b"JuliaLang is a GitHub organization.")
IOBuffer(data=UInt8[...], readable=true, writable=false, seekable=true, append=false, size=35, maxsize=Inf, ptr=1, mark=-1)
julia> read(io, String)
Expand All @@ -70,6 +70,12 @@ julia> write(io, "JuliaLang is a GitHub organization.")
julia> String(take!(io))
"JuliaLang is a GitHub organization"
julia> length(read(IOBuffer(b"data", read=true, truncate=false)))
4
julia> length(read(IOBuffer(b"data", read=true, truncate=true)))
0
```
"""
function IOBuffer(
Expand Down Expand Up @@ -106,9 +112,6 @@ function IOBuffer(;
truncate=flags.truncate,
maxsize=maxsize)
buf.data[:] = 0
if flags.truncate
buf.size = 0
end
return buf
end

Expand Down

0 comments on commit 2ca63e1

Please sign in to comment.