![]() |
OpenMS
|
Decompresses a single-entry ZIP archive for streaming reading. More...
#include <OpenMS/FORMAT/ZipIfstream.h>
Public Member Functions | |
| ZipIfstream () | |
| Default Constructor. | |
| ZipIfstream (const char *filename) | |
| Detailed constructor with filename. | |
| virtual | ~ZipIfstream () |
| Destructor. | |
| size_t | read (char *s, size_t n) |
| Reads n bytes from the zip entry into buffer s. | |
| bool | streamEnd () const |
| indicates whether the read function can be used safely | |
| bool | isOpen () const |
| returns whether a file is open. | |
| void | open (const char *filename) |
| opens a ZIP archive for reading from its single non-directory entry | |
| void | close () |
| closes current file. | |
| ZipIfstream (const ZipIfstream &)=delete | |
| ZipIfstream & | operator= (const ZipIfstream &)=delete |
| ZipIfstream (ZipIfstream &&)=delete | |
| ZipIfstream & | operator= (ZipIfstream &&)=delete |
Protected Attributes | |
| void * | zip_archive_ = nullptr |
| opaque pointers to libzip handles (void* to avoid including zip.h in header) | |
| void * | zip_entry_ = nullptr |
| bool | stream_at_end_ = true |
| true if end of entry is reached | |
Decompresses a single-entry ZIP archive for streaming reading.
Wraps libzip to stream bytes from the single non-directory entry in a ZIP file. Directory entries (names ending with '/') are silently skipped. Exactly one non-directory entry must be present; otherwise open() throws.
| ZipIfstream | ( | ) |
Default Constructor.
|
explicit |
Detailed constructor with filename.
|
virtual |
Destructor.
|
delete |
|
delete |
| void close | ( | ) |
closes current file.
|
inline |
returns whether a file is open.
References ZipIfstream::zip_entry_.
| void open | ( | const char * | filename | ) |
opens a ZIP archive for reading from its single non-directory entry
| Exception::FileNotFound | if file does not exist |
| Exception::FileNotReadable | if file cannot be opened |
| Exception::FileEmpty | if ZIP contains no non-directory entries |
| Exception::ParseError | if ZIP contains more than one non-directory entry |
|
delete |
|
delete |
| size_t read | ( | char * | s, |
| size_t | n | ||
| ) |
Reads n bytes from the zip entry into buffer s.
| [out] | s | Buffer to be filled with the output |
| [in] | n | The size of the buffer s |
| Exception::ParseError | is thrown if decompression fails |
| Exception::IllegalArgument | is thrown if no file for decompression is given |
|
inline |
indicates whether the read function can be used safely
References ZipIfstream::stream_at_end_.
|
protected |
true if end of entry is reached
Referenced by ZipIfstream::streamEnd().
|
protected |
opaque pointers to libzip handles (void* to avoid including zip.h in header)
|
protected |
Referenced by ZipIfstream::isOpen().