Skip to content

Commit

Permalink
Add warning about serialize and deepcopy not being supported (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhz2 authored Jan 8, 2025
1 parent 3f91138 commit 3b9c608
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/compression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ Arguments
---------
- `level`: compression level (-1..9)
- `windowbits`: size of history buffer (9..15)
!!! warning
`serialize` and `deepcopy` will not work with this codec due to stored raw pointers.
"""
function GzipCompressor(;level::Integer=Z_DEFAULT_COMPRESSION,
windowbits::Integer=Z_DEFAULT_WINDOWBITS)
Expand All @@ -43,6 +46,9 @@ const GzipCompressorStream{S} = TranscodingStream{GzipCompressor,S} where S<:IO
GzipCompressorStream(stream::IO; kwargs...)
Create a gzip compression stream (see `GzipCompressor` for `kwargs`).
!!! warning
`serialize` and `deepcopy` will not work with this stream due to stored raw pointers.
"""
function GzipCompressorStream(stream::IO; kwargs...)
x, y = splitkwargs(kwargs, (:level, :windowbits))
Expand All @@ -68,6 +74,9 @@ Arguments
---------
- `level`: compression level (-1..9)
- `windowbits`: size of history buffer (9..15)
!!! warning
`serialize` and `deepcopy` will not work with this codec due to stored raw pointers.
"""
function ZlibCompressor(;level::Integer=Z_DEFAULT_COMPRESSION,
windowbits::Integer=Z_DEFAULT_WINDOWBITS)
Expand All @@ -85,6 +94,9 @@ const ZlibCompressorStream{S} = TranscodingStream{ZlibCompressor,S} where S<:IO
ZlibCompressorStream(stream::IO)
Create a zlib compression stream (see `ZlibCompressor` for `kwargs`).
!!! warning
`serialize` and `deepcopy` will not work with this stream due to stored raw pointers.
"""
function ZlibCompressorStream(stream::IO; kwargs...)
x, y = splitkwargs(kwargs, (:level, :windowbits))
Expand All @@ -110,6 +122,9 @@ Arguments
---------
- `level`: compression level (-1..9)
- `windowbits`: size of history buffer (9..15)
!!! warning
`serialize` and `deepcopy` will not work with this codec due to stored raw pointers.
"""
function DeflateCompressor(;level::Integer=Z_DEFAULT_COMPRESSION,
windowbits::Integer=Z_DEFAULT_WINDOWBITS)
Expand All @@ -127,6 +142,9 @@ const DeflateCompressorStream{S} = TranscodingStream{DeflateCompressor,S} where
DeflateCompressorStream(stream::IO; kwargs...)
Create a deflate compression stream (see `DeflateCompressor` for `kwargs`).
!!! warning
`serialize` and `deepcopy` will not work with this stream due to stored raw pointers.
"""
function DeflateCompressorStream(stream::IO; kwargs...)
x, y = splitkwargs(kwargs, (:level, :windowbits))
Expand Down
18 changes: 18 additions & 0 deletions src/decompression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ Arguments
---------
- `windowbits`: size of history buffer (8..15)
- `gziponly`: flag to inactivate data format detection
!!! warning
`serialize` and `deepcopy` will not work with this codec due to stored raw pointers.
"""
function GzipDecompressor(;windowbits::Integer=Z_DEFAULT_WINDOWBITS, gziponly::Bool=false)
if !(8 windowbits 15)
Expand All @@ -41,6 +44,9 @@ const GzipDecompressorStream{S} = TranscodingStream{GzipDecompressor,S} where S<
GzipDecompressorStream(stream::IO; kwargs...)
Create a gzip decompression stream (see `GzipDecompressor` for `kwargs`).
!!! warning
`serialize` and `deepcopy` will not work with this stream due to stored raw pointers.
"""
function GzipDecompressorStream(stream::IO; kwargs...)
x, y = splitkwargs(kwargs, (:windowbits, :gziponly))
Expand All @@ -64,6 +70,9 @@ Create a zlib decompression codec.
Arguments
---------
- `windowbits`: size of history buffer (8..15)
!!! warning
`serialize` and `deepcopy` will not work with this codec due to stored raw pointers.
"""
function ZlibDecompressor(;windowbits::Integer=Z_DEFAULT_WINDOWBITS)
if !(8 windowbits 15)
Expand All @@ -78,6 +87,9 @@ const ZlibDecompressorStream{S} = TranscodingStream{ZlibDecompressor,S} where S<
ZlibDecompressorStream(stream::IO; kwargs...)
Create a deflate decompression stream (see `ZlibDecompressor` for `kwargs`).
!!! warning
`serialize` and `deepcopy` will not work with this stream due to stored raw pointers.
"""
function ZlibDecompressorStream(stream::IO; kwargs...)
x, y = splitkwargs(kwargs, (:windowbits,))
Expand All @@ -101,6 +113,9 @@ Create a deflate decompression codec.
Arguments
---------
- `windowbits`: size of history buffer (8..15)
!!! warning
`serialize` and `deepcopy` will not work with this codec due to stored raw pointers.
"""
function DeflateDecompressor(;windowbits::Integer=Z_DEFAULT_WINDOWBITS)
if !(8 windowbits 15)
Expand All @@ -115,6 +130,9 @@ const DeflateDecompressorStream{S} = TranscodingStream{DeflateDecompressor,S} wh
DeflateDecompressorStream(stream::IO; kwargs...)
Create a deflate decompression stream (see `DeflateDecompressor` for `kwargs`).
!!! warning
`serialize` and `deepcopy` will not work with this stream due to stored raw pointers.
"""
function DeflateDecompressorStream(stream::IO; kwargs...)
x, y = splitkwargs(kwargs, (:windowbits,))
Expand Down

0 comments on commit 3b9c608

Please sign in to comment.