Skip to content

Commit

Permalink
make stream types a subtype of TranscodingStream
Browse files Browse the repository at this point in the history
  • Loading branch information
bicycle1885 committed Jun 11, 2017
1 parent f4bb55d commit dc697b1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/compression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function Bzip2Compression(;blocksize100k::Integer=DEFAULT_BLOCKSIZE100K,
return Bzip2Compression(BZStream(), blocksize100k, workfactor, verbosity)
end

const Bzip2CompressionStream{S} = TranscodingStream{Bzip2Compression,S}
const Bzip2CompressionStream{S} = TranscodingStream{Bzip2Compression,S} where S<:IO

"""
Bzip2CompressionStream(stream::IO; kwargs...)
Expand Down
2 changes: 1 addition & 1 deletion src/decompression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function Bzip2Decompression(;small::Bool=false, verbosity::Integer=DEFAULT_VERBO
return Bzip2Decompression(BZStream(), small, verbosity)
end

const Bzip2DecompressionStream{S} = TranscodingStream{Bzip2Decompression,S}
const Bzip2DecompressionStream{S} = TranscodingStream{Bzip2Decompression,S} where S<:IO

"""
Bzip2DecompressionStream(stream::IO; kwargs...)
Expand Down
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import TranscodingStreams
write(stream, b"bar", TranscodingStreams.TOKEN_END)
@test read(Bzip2DecompressionStream(IOBuffer(take!(buf)))) == b"foobar"

@test Bzip2CompressionStream <: TranscodingStreams.TranscodingStream
@test Bzip2DecompressionStream <: TranscodingStreams.TranscodingStream

TranscodingStreams.test_roundtrip_read(Bzip2CompressionStream, Bzip2DecompressionStream)
TranscodingStreams.test_roundtrip_write(Bzip2CompressionStream, Bzip2DecompressionStream)
TranscodingStreams.test_roundtrip_lines(Bzip2CompressionStream, Bzip2DecompressionStream)
Expand Down

0 comments on commit dc697b1

Please sign in to comment.