Skip to content

Commit 2bc177c

Browse files
authored
Bump requirements (#36)
1 parent 93332f5 commit 2bc177c

File tree

6 files changed

+62
-62
lines changed

6 files changed

+62
-62
lines changed

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,22 @@ erat ex bibendum ipsum, sed varius ipsum ipsum vitae dui.
4242

4343
# Streaming API.
4444
stream = IOBuffer(text)
45-
stream = TranscodingStream(GzipCompression(), stream)
46-
stream = TranscodingStream(GzipDecompression(), stream)
45+
stream = TranscodingStream(GzipCompressor(), stream)
46+
stream = TranscodingStream(GzipDecompressor(), stream)
4747
for line in eachline(stream)
4848
println(line)
4949
end
5050
close(stream)
5151

5252
# Array API.
5353
array = Vector{UInt8}(text)
54-
array = transcode(GzipCompression, array)
55-
array = transcode(GzipDecompression, array)
54+
array = transcode(GzipCompressor, array)
55+
array = transcode(GzipDecompressor, array)
5656
@assert text == String(array)
5757
```
5858

5959
Each codec has an alias to its transcoding stream type for ease of use. For
60-
example, `GzipCompressionStream{S} = TranscodingStream{GzipCompression,S} where
60+
example, `GzipCompressorStream{S} = TranscodingStream{GzipCompressor,S} where
6161
S<:IO`.
6262

6363
## Codec packages

docs/src/examples.md

+19-19
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ Read lines from a gzip-compressed file
55
--------------------------------------
66

77
The following snippet is an example of using CodecZlib.jl, which exports
8-
`GzipDecompressionStream{S}` as an alias of
9-
`TranscodingStream{GzipDecompression,S} where S<:IO`:
8+
`GzipDecompressorStream{S}` as an alias of
9+
`TranscodingStream{GzipDecompressor,S} where S<:IO`:
1010
```julia
1111
using CodecZlib
12-
stream = GzipDecompressionStream(open("data.txt.gz"))
12+
stream = GzipDecompressorStream(open("data.txt.gz"))
1313
for line in eachline(stream)
1414
# do something...
1515
end
@@ -21,7 +21,7 @@ Note that the last `close` call will close the file as well. Alternatively,
2121
end:
2222
```julia
2323
using CodecZlib
24-
open(GzipDecompressionStream, "data.txt.gz") do stream
24+
open(GzipDecompressorStream, "data.txt.gz") do stream
2525
for line in eachline(stream)
2626
# do something...
2727
end
@@ -36,7 +36,7 @@ The input is not limited to usual files. You can read data from a pipe
3636
```julia
3737
using CodecZlib
3838
pipe, proc = open(`cat some.data.gz`)
39-
stream = GzipDecompressionStream(pipe)
39+
stream = GzipDecompressorStream(pipe)
4040
for line in eachline(stream)
4141
# do something...
4242
end
@@ -51,7 +51,7 @@ Writing compressed data is easy. One thing you need to keep in mind is to call
5151
```julia
5252
using CodecZstd
5353
mat = randn(100, 100)
54-
stream = ZstdCompressionStream(open("data.mat.zst", "w"))
54+
stream = ZstdCompressorStream(open("data.mat.zst", "w"))
5555
writedlm(stream, mat)
5656
close(stream)
5757
```
@@ -60,7 +60,7 @@ Of course, `open(<stream type>, ...) do ... end` works well:
6060
```julia
6161
using CodecZstd
6262
mat = randn(100, 100)
63-
open(ZstdCompressionStream, "data.mat.zst", "w") do stream
63+
open(ZstdCompressorStream, "data.mat.zst", "w") do stream
6464
writedlm(stream, mat)
6565
end
6666
```
@@ -77,7 +77,7 @@ transcoding stream as follows:
7777
using CodecZstd
7878
using TranscodingStreams
7979
buf = IOBuffer()
80-
stream = ZstdCompressionStream(buf)
80+
stream = ZstdCompressorStream(buf)
8181
write(stream, "foobarbaz"^100, TranscodingStreams.TOKEN_END)
8282
flush(stream)
8383
compressed = take!(buf)
@@ -88,17 +88,17 @@ Use a noop codec
8888
----------------
8989

9090
Sometimes, the `Noop` codec, which does nothing, may be useful. The following
91-
example creates a decompression stream based on the extension of a filepath:
91+
example creates a decompressor stream based on the extension of a filepath:
9292
```julia
9393
using CodecZlib
9494
using CodecBzip2
9595
using TranscodingStreams
9696

9797
function makestream(filepath)
9898
if endswith(filepath, ".gz")
99-
codec = GzipDecompression()
99+
codec = GzipDecompressor()
100100
elseif endswith(filepath, ".bz2")
101-
codec = Bzip2Decompression()
101+
codec = Bzip2Decompressor()
102102
else
103103
codec = Noop()
104104
end
@@ -123,7 +123,7 @@ using CodecZstd
123123
input = open("data.txt.gz", "r")
124124
output = open("data.txt.zst", "w")
125125

126-
stream = GzipDecompressionStream(ZstdCompressionStream(output))
126+
stream = GzipDecompressorStream(ZstdCompressorStream(output))
127127
write(stream, input)
128128
close(stream)
129129
```
@@ -137,13 +137,13 @@ Stop decoding on the end of a block
137137

138138
Most codecs support decoding concatenated data blocks. For example, if you
139139
concatenate two gzip files into a file and read it using
140-
`GzipDecompressionStream`, you will see the byte stream of concatenation of two
140+
`GzipDecompressorStream`, you will see the byte stream of concatenation of two
141141
files. If you need the first part of the file, you can set `stop_on_end` to
142142
`true` to stop transcoding at the end of the first block:
143143
```julia
144144
using CodecZlib
145145
# cat foo.txt.gz bar.txt.gz > foobar.txt.gz
146-
stream = GzipDecompressionStream(open("foobar.txt.gz"), stop_on_end=true)
146+
stream = GzipDecompressorStream(open("foobar.txt.gz"), stop_on_end=true)
147147
read(stream) #> the content of foo.txt
148148
eof(stream) #> true
149149
```
@@ -156,8 +156,8 @@ problem of overreading is resolved:
156156
using CodecZlib
157157
using TranscodingStreams
158158
stream = NoopStream(open("foobar.txt.gz"))
159-
read(GzipDecompressionStream(stream, stop_on_end=true)) #> the content of foo.txt
160-
read(GzipDecompressionStream(stream, stop_on_end=true)) #> the content of bar.txt
159+
read(GzipDecompressorStream(stream, stop_on_end=true)) #> the content of foo.txt
160+
read(GzipDecompressorStream(stream, stop_on_end=true)) #> the content of bar.txt
161161
```
162162

163163
Check I/O statistics
@@ -181,7 +181,7 @@ function decompress(input, output)
181181
println(STDERR)
182182
end
183183

184-
input = GzipDecompressionStream(open("foobar.txt.gz"))
184+
input = GzipDecompressorStream(open("foobar.txt.gz"))
185185
output = IOBuffer()
186186
decompress(input, output)
187187
```
@@ -197,7 +197,7 @@ in one shot. `transcode` takes a codec object as its first argument and a data
197197
vector as its second argument:
198198
```julia
199199
using CodecZlib
200-
decompressed = transcode(ZlibDecompression, b"x\x9cKL*JLNLI\x04R\x00\x19\xf2\x04U")
200+
decompressed = transcode(ZlibDecompressor, b"x\x9cKL*JLNLI\x04R\x00\x19\xf2\x04U")
201201
String(decompressed)
202202
```
203203

@@ -211,7 +211,7 @@ data)` method that reuses the allocated object as follows:
211211
```julia
212212
using CodecZstd
213213
strings = ["foo", "bar", "baz"]
214-
codec = ZstdCompression()
214+
codec = ZstdCompressor()
215215
try
216216
for s in strings
217217
data = transcode(codec, s)

docs/src/index.md

+28-28
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Introduction
2121
the actual type should be written as `TranscodingStream{C<:Codec,S<:IO}`. This
2222
type wraps an underlying I/O stream `S` by a codec `C`. The codec defines
2323
transformation (or transcoding) of the stream. For example, when `C` is a
24-
lossless decompression type and `S` is a file, `TranscodingStream{C,S}` behaves
24+
lossless decompressor type and `S` is a file, `TranscodingStream{C,S}` behaves
2525
like a data stream that incrementally decompresses data from the file.
2626

2727
Codecs are defined in other packages listed below:
@@ -40,74 +40,74 @@ Codecs are defined in other packages listed below:
4040
<td rowspan="6"><a href="https://github.com/bicycle1885/CodecZlib.jl">CodecZlib.jl</a></td>
4141
<td rowspan="6"><a href="http://zlib.net/">zlib</a></td>
4242
<td rowspan="2"><a href="https://tools.ietf.org/html/rfc1952">RFC1952</a></td>
43-
<td><code>GzipCompression</code></td>
44-
<td><code>GzipCompressionStream</code></td>
43+
<td><code>GzipCompressor</code></td>
44+
<td><code>GzipCompressorStream</code></td>
4545
<td>Compress data in gzip (.gz) format.</td>
4646
</tr>
4747
<tr>
48-
<td><code>GzipDecompression</code></td>
49-
<td><code>GzipDecompressionStream</code></td>
48+
<td><code>GzipDecompressor</code></td>
49+
<td><code>GzipDecompressorStream</code></td>
5050
<td>Decompress data in gzip (.gz) format.</td>
5151
</tr>
5252
<tr>
5353
<td rowspan="2"><a href="https://tools.ietf.org/html/rfc1950">RFC1950</a></td>
54-
<td><code>ZlibCompression</code></td>
55-
<td><code>ZlibCompressionStream</code></td>
54+
<td><code>ZlibCompressor</code></td>
55+
<td><code>ZlibCompressorStream</code></td>
5656
<td>Compress data in zlib format.</td>
5757
</tr>
5858
<tr>
59-
<td><code>ZlibDecompression</code></td>
60-
<td><code>ZlibDecompressionStream</code></td>
59+
<td><code>ZlibDecompressor</code></td>
60+
<td><code>ZlibDecompressorStream</code></td>
6161
<td>Decompress data in zlib format.</td>
6262
</tr>
6363
<tr>
6464
<td rowspan="2"><a href="https://tools.ietf.org/html/rfc1951">RFC1951</a></td>
65-
<td><code>DeflateCompression</code></td>
66-
<td><code>DeflateCompressionStream</code></td>
65+
<td><code>DeflateCompressor</code></td>
66+
<td><code>DeflateCompressorStream</code></td>
6767
<td>Compress data in deflate format.</td>
6868
</tr>
6969
<tr>
70-
<td><code>DeflateDecompression</code></td>
71-
<td><code>DeflateDecompressionStream</code></td>
70+
<td><code>DeflateDecompressor</code></td>
71+
<td><code>DeflateDecompressorStream</code></td>
7272
<td>Decompress data in deflate format.</td>
7373
</tr>
7474
<tr>
7575
<td rowspan="2"><a href="https://github.com/bicycle1885/CodecBzip2.jl">CodecBzip2.jl</a></td>
7676
<td rowspan="2"><a href="http://www.bzip.org/">bzip2</a></td>
7777
<td rowspan="2"></td>
78-
<td><code>Bzip2Compression</code></td>
79-
<td><code>Bzip2CompressionStream</code></td>
78+
<td><code>Bzip2Compressor</code></td>
79+
<td><code>Bzip2CompressorStream</code></td>
8080
<td>Compress data in bzip2 (.bz2) format.</td>
8181
</tr>
8282
<tr>
83-
<td><code>Bzip2Decompression</code></td>
84-
<td><code>Bzip2DecompressionStream</code></td>
83+
<td><code>Bzip2Decompressor</code></td>
84+
<td><code>Bzip2DecompressorStream</code></td>
8585
<td>Decompress data in bzip2 (.bz2) format.</td>
8686
</tr>
8787
<tr>
8888
<td rowspan="2"><a href="https://github.com/bicycle1885/CodecXz.jl">CodecXz.jl</a></td>
8989
<td rowspan="2"><a href="https://tukaani.org/xz/">xz</a></td>
9090
<td rowspan="2"><a href="https://tukaani.org/xz/xz-file-format.txt">The .xz File Format</a></td>
91-
<td><code>XzCompression</code></td>
92-
<td><code>XzCompressionStream</code></td>
91+
<td><code>XzCompressor</code></td>
92+
<td><code>XzCompressorStream</code></td>
9393
<td>Compress data in xz (.xz) format.</td>
9494
</tr>
9595
<tr>
96-
<td><code>XzDecompression</code></td>
97-
<td><code>XzDecompressionStream</code></td>
96+
<td><code>XzDecompressor</code></td>
97+
<td><code>XzDecompressorStream</code></td>
9898
<td>Decompress data in xz (.xz) format.</td>
9999
</tr>
100100
<tr>
101101
<td rowspan="2"><a href="https://github.com/bicycle1885/CodecZstd.jl">CodecZstd.jl</a></td>
102102
<td rowspan="2"><a href="http://facebook.github.io/zstd/">zstd</a></td>
103-
<td rowspan="2"><a href="https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md">Zstandard Compression Format</a></td>
104-
<td><code>ZstdCompression</code></td>
105-
<td><code>ZstdCompressionStream</code></td>
103+
<td rowspan="2"><a href="https://github.com/facebook/zstd/blob/dev/doc/zstd_compressor_format.md">Zstandard Compressor Format</a></td>
104+
<td><code>ZstdCompressor</code></td>
105+
<td><code>ZstdCompressorStream</code></td>
106106
<td>Compress data in zstd (.zst) format.</td>
107107
</tr>
108108
<tr>
109-
<td><code>ZstdDecompression</code></td>
110-
<td><code>ZstdDecompressionStream</code></td>
109+
<td><code>ZstdDecompressor</code></td>
110+
<td><code>ZstdDecompressorStream</code></td>
111111
<td>Decompress data in zstd (.zst) format.</td>
112112
</tr>
113113
<tr>
@@ -148,7 +148,7 @@ Codecs are defined in other packages listed below:
148148

149149
Install packages you need by calling `Pkg.add(<package name>)` in a Julia
150150
session. For example, if you want to read gzip-compressed files, call
151-
`Pkg.add("CodecZlib")` to use `GzipDecompression` or `GzipDecompressionStream`.
151+
`Pkg.add("CodecZlib")` to use `GzipDecompressor` or `GzipDecompressorStream`.
152152
By convention, codec types have a name that matches `.*(Co|Deco)mpression` and
153153
I/O types have a codec name with `Stream` suffix. All codecs are a subtype
154154
`TranscodingStreams.Codec` and streams are a subtype of `Base.IO`. An important
@@ -163,7 +163,7 @@ Error handling
163163
--------------
164164

165165
You may encounter an error while processing data with this package. For example,
166-
your compressed data may be corrupted or truncated and the decompression codec
166+
your compressed data may be corrupted or truncated and the decompressor codec
167167
cannot handle it properly. In this case, the codec informs the stream of the
168168
error and the stream goes to an unrecoverable mode. In this mode, the only
169169
possible operations are `isopen` and `close`. Other operations, such as `read`

src/stream.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ julia> using CodecZlib
9595
9696
julia> file = open(Pkg.dir("TranscodingStreams", "test", "abra.gzip"));
9797
98-
julia> stream = TranscodingStream(GzipDecompression(), file)
99-
TranscodingStreams.TranscodingStream{CodecZlib.GzipDecompression,IOStream}(<mode=idle>)
98+
julia> stream = TranscodingStream(GzipDecompressor(), file)
99+
TranscodingStreams.TranscodingStream{CodecZlib.GzipDecompressor,IOStream}(<mode=idle>)
100100
101101
julia> readstring(stream)
102102
"abracadabra"

src/transcode.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ julia> using CodecZlib
1818
1919
julia> data = b"abracadabra";
2020
21-
julia> compressed = transcode(ZlibCompression, data);
21+
julia> compressed = transcode(ZlibCompressor, data);
2222
23-
julia> decompressed = transcode(ZlibDecompression, compressed);
23+
julia> decompressed = transcode(ZlibDecompressor, compressed);
2424
2525
julia> String(decompressed)
2626
"abracadabra"
@@ -52,9 +52,9 @@ julia> using CodecZlib
5252
5353
julia> data = b"abracadabra";
5454
55-
julia> compressed = transcode(ZlibCompression(), data);
55+
julia> compressed = transcode(ZlibCompressor, data);
5656
57-
julia> decompressed = transcode(ZlibDecompression(), compressed);
57+
julia> decompressed = transcode(ZlibDecompressor, compressed);
5858
5959
julia> String(decompressed)
6060
"abracadabra"

test/REQUIRE

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
CodecZlib 0.3
2-
CodecBzip2 0.3
3-
CodecXz 0.3
4-
CodecZstd 0.3
1+
CodecZlib 0.4
2+
CodecBzip2 0.4
3+
CodecXz 0.4
4+
CodecZstd 0.4
55
CodecBase 0.1

0 commit comments

Comments
 (0)