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 bf591e8 commit e89efb7
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 @@ -29,7 +29,7 @@ function XzCompression(;level::Integer=DEFAULT_COMPRESSION_LEVEL, check::Cint=DE
return XzCompression(LZMAStream(), level, check)
end

const XzCompressionStream{S} = TranscodingStream{XzCompression,S}
const XzCompressionStream{S} = TranscodingStream{XzCompression,S} where S<:IO

"""
XzCompressionStream(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 @@ -27,7 +27,7 @@ function XzDecompression(;memlimit::Integer=DEFAULT_MEM_LIMIT, flags::UInt32=LZM
return XzDecompression(LZMAStream(), memlimit, flags)
end

const XzDecompressionStream{S} = TranscodingStream{XzDecompression,S}
const XzDecompressionStream{S} = TranscodingStream{XzDecompression,S} where S<:IO

"""
XzDecompressionStream(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 @@ -11,6 +11,9 @@ import TranscodingStreams
data[[1,3,5]] = b"bug"
@test_throws ErrorException read(XzDecompressionStream(IOBuffer(data)))

@test XzCompressionStream <: TranscodingStreams.TranscodingStream
@test XzDecompressionStream <: TranscodingStreams.TranscodingStream

TranscodingStreams.test_roundtrip_read(XzCompressionStream, XzDecompressionStream)
TranscodingStreams.test_roundtrip_write(XzCompressionStream, XzDecompressionStream)
TranscodingStreams.test_roundtrip_lines(XzCompressionStream, XzDecompressionStream)
Expand Down

0 comments on commit e89efb7

Please sign in to comment.