![]() |
OpenMS
|
Xerces InputSource that opens a bzip2-, zip- or gzip-compressed file on demand.
More...
#include <OpenMS/FORMAT/CompressedInputSource.h>
Public Member Functions | |
| CompressedInputSource (const std::string &file_path, const std::string &header, xercesc::MemoryManager *const manager=xercesc::XMLPlatformUtils::fgMemoryManager) | |
Construct from a UTF-8 String path. | |
| CompressedInputSource (const XMLCh *const file_path, const std::string &header, xercesc::MemoryManager *const manager=xercesc::XMLPlatformUtils::fgMemoryManager) | |
Construct from a wide-character (XMLCh) path. | |
| ~CompressedInputSource () override | |
| Destructor. | |
| xercesc::BinInputStream * | makeStream () const override |
| Create the decompression input stream for this source. | |
Private Member Functions | |
| CompressedInputSource () | |
| Default construction is deliberately suppressed (declared but not defined). | |
| CompressedInputSource (const CompressedInputSource &source) | |
| Copy construction is deliberately suppressed (declared but not defined). | |
| CompressedInputSource & | operator= (const CompressedInputSource &source) |
| Assignment is deliberately suppressed (declared but not defined). | |
Private Attributes | |
| std::string | head_ |
| Header bytes captured at construction; makeStream uses the first two characters to pick a decompressor. | |
Xerces InputSource that opens a bzip2-, zip- or gzip-compressed file on demand.
Resolves the file path the same way as xercesc::LocalFileInputSource (relative paths are completed against the current working directory), but makeStream picks an OpenMS decompression stream (Bzip2InputStream, ZipInputStream or GzipInputStream) based on the first two bytes of the file as passed to the constructor.
Copy construction, copy assignment and default construction are deliberately suppressed.
| CompressedInputSource | ( | const std::string & | file_path, |
| const std::string & | header, | ||
| xercesc::MemoryManager *const | manager = xercesc::XMLPlatformUtils::fgMemoryManager |
||
| ) |
Construct from a UTF-8 String path.
| [in] | file_path | Path to the compressed file; relative paths are completed against Xerces' current working directory. |
| [in] | header | First two bytes of the file; makeStream uses them to pick the decompressor. "BZ" selects bzip2, "PK" selects zip, anything else (including a header shorter than two characters, which is silently replaced with two NUL bytes) selects gzip. |
| [in] | manager | Memory manager used for Xerces allocations. Defaults to the platform-wide manager. |
| CompressedInputSource | ( | const XMLCh *const | file_path, |
| const std::string & | header, | ||
| xercesc::MemoryManager *const | manager = xercesc::XMLPlatformUtils::fgMemoryManager |
||
| ) |
Construct from a wide-character (XMLCh) path.
| [in] | file_path | Path to the compressed file; relative paths are completed against Xerces' current working directory. |
| [in] | header | Same semantics as the header argument of the String overload of this constructor. |
| [in] | manager | Memory manager used for Xerces allocations. Defaults to the platform-wide manager. |
|
override |
Destructor.
|
private |
Default construction is deliberately suppressed (declared but not defined).
|
private |
Copy construction is deliberately suppressed (declared but not defined).
|
override |
Create the decompression input stream for this source.
Inspects the header passed to the constructor and returns a newly-allocated BinInputStream of the matching type:
"BZ" -> Bzip2InputStream"PK" -> ZipInputStreamOwnership of the returned stream is transferred to the caller (typically the Xerces parser).
nullptr when the chosen stream fails to open the file.
|
private |
Assignment is deliberately suppressed (declared but not defined).
|
private |
Header bytes captured at construction; makeStream uses the first two characters to pick a decompressor.