zipios
2.2.0
Zipios -- a small C++ library that provides easy access to .zip files.
|
Go to the documentation of this file.
62 size_t central_directory_size(0);
63 for(
auto it = entries.begin(); it != entries.end(); ++it)
66 central_directory_size += (*it)->getHeaderSize();
233 entry->setEntryOffset(os.tellp());
278 size_t const size(pptr() - pbase());
292 throw IOException(
"ZipOutputStreambuf::overflow(): write to buffer failed.");
364 int const curr_pos(os.tellp());
374 entry->setCompressedSize(curr_pos - entry->getEntryOffset() -
static_cast<ZipLocalEntry *
>(entry.get())->ZipLocalEntry::getHeaderSize());
377 os.seekp(entry->getEntryOffset());
void writeZipCentralDirectory(std::ostream &os, FileEntry::vector_t &entries, std::string const &comment)
Help function used to write the central directory.
Declare the zipios::ZipLocalEntry class used to handle Zip entries.
void setOffset(offset_t new_offset)
Offset of the Central Directory.
size_t getSize() const
Retrieve the size of the file deflated.
void putNextEntry(FileEntry::pointer_t entry)
Start saving an entry in the output buffer.
void setComment(std::string const &comment)
Set the archive comment.
std::vector< char > m_invec
bool init(FileEntry::CompressionLevel compression_level)
Initialize the zlib library.
virtual int overflow(int c=EOF)
Handle an overflow.
virtual int sync()
Synchronize the buffer.
Various exceptions used throughout the Zipios library, all based on zipios::Exception.
FileEntry::vector_t m_entries
std::shared_ptr< FileEntry > pointer_t
virtual int overflow(int c=EOF) override
Implementation of the overflow() function.
void write(std::ostream &os)
Write the ZipEndOfCentralDirectory structure to a stream.
FileEntry::CompressionLevel m_compression_level
void updateEntryHeaderInfo()
Save the header information.
void setEntryClosedState()
Mark the current entry as closed.
uint32_t getCrc32() const
Get the CRC32 of the file.
void closeEntry()
Close this buffer entry.
An IOException is used to signal an I/O error.
void setCentralDirectorySize(size_t size)
Define the size of the central directory.
void closeStream()
Closing the stream.
virtual void write(std::ostream &os) override
Write a ZipLocalEntry to os.
static CompressionLevel const COMPRESSION_LEVEL_NONE
void close()
Close the output stream buffer.
An implementation of the FileEntry for Zip archives.
virtual ~ZipOutputStreambuf()
Clean up the buffer.
std::string m_zip_comment
A class to handle stream deflate on the fly.
Define the zipios::ZipOutputStreambuf class.
void finish()
Finish up an output stream buffer.
ZipOutputStreambuf(std::streambuf *outbuf)
Initialize a ZipOutputStreambuf object.
void setCount(size_t c)
Set the number of entries.
virtual int sync() override
Implement the sync() functionality.
Marker at the end of a Zip archive file.
std::streambuf * m_outbuf
Declaration of the zipios::ZipEndOfCentralDirectory class.
uint32_t m_overflown_bytes
std::vector< pointer_t > vector_t
The zipios namespace includes the Zipios library definitions.