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