![]() |
OpenMS
|
Decompresses gzip or bzip2 data read from another InputStream, e.g. a remote object. More...
#include <OpenMS/FORMAT/DecompressingInputStream.h>
Public Types | |
| enum class | Format { GZIP , BZIP2 } |
Public Member Functions | |
| DecompressingInputStream (std::unique_ptr< InputStream > source, Format format, const std::string &name) | |
Decompresses source, which holds data in format. | |
| ~DecompressingInputStream () override | |
| UInt64 | curPos () const override |
| The number of decompressed bytes read so far. | |
| Size | readBytes (unsigned char *to_fill, Size max_to_read) override |
Reads up to max_to_read decompressed bytes into to_fill; 0 at the end of the data. | |
| void | cancel () override |
| Cancels a blocking read of the source stream. | |
| DecompressingInputStream (const DecompressingInputStream &)=delete | |
| DecompressingInputStream & | operator= (const DecompressingInputStream &)=delete |
Public Member Functions inherited from InputStream | |
| virtual | ~InputStream ()=default |
Static Public Member Functions | |
| static std::optional< Format > | detect (const unsigned char *head, Size size) |
The format whose magic bytes start head (1F 8B: gzip, "BZh": bzip2), if any. | |
Private Attributes | |
| std::unique_ptr< Impl > | impl_ |
| zlib/bzip2 state (their headers stay out of this one) | |
Decompresses gzip or bzip2 data read from another InputStream, e.g. a remote object.
Unlike GzipInputStream and Bzip2InputStream, which open local files, this decompresses an arbitrary stream on the fly. Concatenated members (as written by pigz or pbzip2) are read in sequence. Bytes after the last member that do not start another member are ignored, as gzread() does.
Errors of the source stream propagate. Corrupt or truncated compressed data throws Exception::ParseError.
|
strong |
| DecompressingInputStream | ( | std::unique_ptr< InputStream > | source, |
| Format | format, | ||
| const std::string & | name | ||
| ) |
Decompresses source, which holds data in format.
| [in] | source | The compressed stream; it is read from its current position |
| [in] | format | The compression format of source |
| [in] | name | The name of the data, for error messages (e.g. its URI) |
|
override |
|
delete |
|
overridevirtual |
Cancels a blocking read of the source stream.
Reimplemented from InputStream.
|
overridevirtual |
The number of decompressed bytes read so far.
Implements InputStream.
The format whose magic bytes start head (1F 8B: gzip, "BZh": bzip2), if any.
|
delete |
Reads up to max_to_read decompressed bytes into to_fill; 0 at the end of the data.
Implements InputStream.
|
private |
zlib/bzip2 state (their headers stay out of this one)