File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -31,13 +31,18 @@ struct TranscodingStream{C<:Codec,S<:IO} <: IO
31
31
end
32
32
end
33
33
34
+ const DEFAULT_BUFFER_SIZE = 16 * 2 ^ 10 # 16KiB
35
+
34
36
"""
35
- TranscodingStream(codec::Codec, stream::IO)
37
+ TranscodingStream(codec::Codec, stream::IO; bufsize::Integer= $(DEFAULT_BUFFER_SIZE) )
36
38
37
39
Create a transcoding stream with `codec` and `stream`.
38
40
"""
39
- function TranscodingStream (codec:: Codec , stream:: IO )
40
- return TranscodingStream {typeof(codec),typeof(stream)} (codec, stream, State (16 * 2 ^ 10 ))
41
+ function TranscodingStream (codec:: Codec , stream:: IO ; bufsize:: Integer = DEFAULT_BUFFER_SIZE)
42
+ if bufsize ≤ 0
43
+ throw (ArgumentError (" non-positive buffer size" ))
44
+ end
45
+ return TranscodingStream {typeof(codec),typeof(stream)} (codec, stream, State (bufsize))
41
46
end
42
47
43
48
function Base. show (io:: IO , stream:: TranscodingStream )
You can’t perform that action at this time.
0 commit comments