@@ -71,16 +71,23 @@ pub struct DecoderReader<R: Read> {
71
71
72
72
/// A gzip streaming decoder that decodes all members of a multistream
73
73
///
74
- /// This structure exposes a `Read` interface that will consume compressed
75
- /// data from the underlying reader and emit uncompressed data.
74
+ /// A gzip member consists of a header, compressed data and a trailer. The [gzip
75
+ /// specification](https://tools.ietf.org/html/rfc1952), however, allows multiple
76
+ /// gzip members to be joined in a single stream. `MultiDecoderReader` will
77
+ /// decode all consecutive members while `DecoderReader` will only decompress the
78
+ /// first gzip member. The multistream format is commonly used in bioinformatics,
79
+ /// for example when using the BGZF compressed data.
80
+ ///
81
+ /// This structure exposes a `Read` interface that will consume all gzip members
82
+ /// from the underlying reader and emit uncompressed data.
76
83
pub struct MultiDecoderReader < R : Read > {
77
84
inner : MultiDecoderReaderBuf < BufReader < R > > ,
78
85
}
79
86
80
87
/// A gzip streaming decoder
81
88
///
82
- /// This structure exposes a `Read` interface that will consume all
83
- /// compressed gzip members from the underlying reader and emit uncompressed data.
89
+ /// This structure exposes a `Read` interface that will consume compressed
90
+ /// data from the underlying reader and emit uncompressed data.
84
91
pub struct DecoderReaderBuf < R : BufRead > {
85
92
inner : CrcReader < deflate:: DecoderReaderBuf < R > > ,
86
93
header : Header ,
@@ -89,8 +96,15 @@ pub struct DecoderReaderBuf<R: BufRead> {
89
96
90
97
/// A gzip streaming decoder that decodes all members of a multistream
91
98
///
92
- /// This structure exposes a `Read` interface that will consume all
93
- /// compressed gzip members from the underlying reader and emit uncompressed data.
99
+ /// A gzip member consists of a header, compressed data and a trailer. The [gzip
100
+ /// specification](https://tools.ietf.org/html/rfc1952), however, allows multiple
101
+ /// gzip members to be joined in a single stream. `MultiDecoderReaderBuf` will
102
+ /// decode all consecutive members while `DecoderReaderBuf` will only decompress
103
+ /// the first gzip member. The multistream format is commonly used in
104
+ /// bioinformatics, for example when using the BGZF compressed data.
105
+ ///
106
+ /// This structure exposes a `Read` interface that will consume all gzip members
107
+ /// from the underlying reader and emit uncompressed data.
94
108
pub struct MultiDecoderReaderBuf < R : BufRead > {
95
109
inner : CrcReader < deflate:: DecoderReaderBuf < R > > ,
96
110
header : Header ,
@@ -503,8 +517,8 @@ impl<R: Read + Write> Write for DecoderReader<R> {
503
517
504
518
impl < R : Read > MultiDecoderReader < R > {
505
519
/// Creates a new decoder from the given reader, immediately parsing the
506
- /// gzip header. If the gzip stream contains multiple members all will be
507
- /// decoded.
520
+ /// (first) gzip header. If the gzip stream contains multiple members all will
521
+ /// be decoded.
508
522
///
509
523
/// If an error is encountered when parsing the gzip header, an error is
510
524
/// returned.
@@ -652,8 +666,8 @@ impl<R: BufRead + Write> Write for DecoderReaderBuf<R> {
652
666
653
667
impl < R : BufRead > MultiDecoderReaderBuf < R > {
654
668
/// Creates a new decoder from the given reader, immediately parsing the
655
- /// gzip header. If the gzip stream contains multiple members all will be
656
- /// decoded.
669
+ /// (first) gzip header. If the gzip stream contains multiple members all will
670
+ /// be decoded.
657
671
///
658
672
/// If an error is encountered when parsing the gzip header, an error is
659
673
/// returned.
0 commit comments