libzipper 1.0.1
|
Reader supplies input data to the compression/decompression functions. More...
#include <zipper.hh>
Public Member Functions | |
virtual | ~Reader () |
Reader dtor. | |
virtual const std::string & | getSourceName () const =0 |
virtual const timeval & | getModTime () const =0 |
virtual zsize_t | getSize () const =0 |
virtual void | readData (zsize_t offset, zsize_t bytes, uint8_t *dest) const =0 |
Reader supplies input data to the compression/decompression functions.
Normally, an application using libzipper provides the Reader implementation. The implementation could supply data from files, in-memory buffers, or it could be generated on-the-fly.
The Reader implementation must support random access, and must determine at creation time the number of bytes available. The Reader interface is not suitable for use with streaming data.
virtual const timeval& zipper::Reader::getModTime | ( | ) | const [pure virtual] |
Return the last-modified timestamp of the data. If the special s_now value is returned, the current time should be used instead.
Implemented in zipper::FileReader.
virtual zsize_t zipper::Reader::getSize | ( | ) | const [pure virtual] |
Returns the number of bytes available via readData()
Implemented in zipper::FileReader.
virtual const std::string& zipper::Reader::getSourceName | ( | ) | const [pure virtual] |
Returns a name for this source of the data.
For file-based Reader implementations, this would normally be the input filename.
Implemented in zipper::FileReader.
virtual void zipper::Reader::readData | ( | zsize_t | offset, |
zsize_t | bytes, | ||
uint8_t * | dest | ||
) | const [pure virtual] |
Copies data into the dest buffer
An exception must be thrown if it is not possible to copy the requested data into the supplied buffer (eg. file IO error).
offset | Number of bytes to skip at the front of the data source. |
bytes | Number of bytes to copy |
dest | Destination buffer. |
Implemented in zipper::FileReader.