Skip to content

Commit ace8e39

Browse files
authored
Merge pull request #20 from tkoolen/iostream-encode
Use Base.IOStream instead of BufferedStreams.BufferedOutputStream by default
2 parents 5bd0e6d + da17e76 commit ace8e39

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lcmtype.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ function encodefield(io::IO, A::AbstractVector)
198198
end
199199

200200
# Sugar
201-
encode(data::Vector{UInt8}, x::LCMType) = encode(BufferedOutputStream(data), x)
202-
encode(x::LCMType) = (stream = BufferedOutputStream(); encode(stream, x); flush(stream); take!(stream))
201+
encode(data::Vector{UInt8}, x::LCMType) = encode(IOBuffer(data, false, true), x)
202+
encode(x::LCMType) = (stream = IOBuffer(false, true); encode(stream, x); flush(stream); take!(stream))
203203

204204
decode!(x::LCMType, data::Vector{UInt8}) = decode!(x, BufferedInputStream(data))
205205
decode(data::Vector{UInt8}, ::Type{T}) where {T<:LCMType} = decode!(T(), data)

0 commit comments

Comments
 (0)