Skip to content

Commit 7e788fc

Browse files
authored
add more docs on TranscodingStream (#34)
1 parent d434ab6 commit 7e788fc

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

src/stream.jl

+18-5
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,30 @@ end
5757
5858
Create a transcoding stream with `codec` and `stream`.
5959
60+
A `TranscodingStream` object wraps an input/output stream object `stream`, and
61+
transcodes the byte stream using `codec`. It is a subtype of `IO` and supports
62+
most of the I/O functions in the standard library.
63+
64+
See the docs (<https://bicycle1885.github.io/TranscodingStreams.jl/stable/>) for
65+
available codecs, examples, and more details of the type.
66+
6067
Arguments
6168
---------
6269
63-
- `codec`: The data transcoder.
64-
- `stream`: The wrapped stream.
65-
- `bufsize`: The initial buffer size.
70+
- `codec`:
71+
The data transcoder. The transcoding stream does the initialization and
72+
finalization of `codec`. Therefore, a codec object is not reusable once it
73+
is passed to a transcoding stream.
74+
- `stream`:
75+
The wrapped stream. It must be opened before passed to the constructor.
76+
- `bufsize`:
77+
The initial buffer size (the default size is 16KiB). The buffer may be
78+
extended whenever `codec` requests so.
6679
- `stop_on_end`:
6780
The flag to stop transcoding on `:end` return code of `codec`. The
6881
transcoded data are readable even after the end of transcoding. Note that
69-
some extra data may be buffered from `stream` and thus `sharedbuf` must be
70-
`true` to reuse `stream`.
82+
some extra data may be read from `stream` into a buffer and thus `sharedbuf`
83+
must be `true` to reuse `stream`.
7184
- `sharedbuf`:
7285
The flag to share buffers between adjacent transcoding streams. The value
7386
must be `false` if `stream` is not a `TranscodingStream` object.

0 commit comments

Comments
 (0)