244 is.setstate(std::ios::failbit);
245 throw IOException(
"ZipCentralDirectoryEntry::read(): Expected Central Directory entry signature not found");
248 uint16_t writer_version(0);
249 uint16_t compress_method(0);
251 uint32_t compressed_size(0);
252 uint32_t uncompressed_size(0);
253 uint32_t rel_offset_loc_head(0);
254 uint16_t filename_len(0);
255 uint16_t extra_field_len(0);
256 uint16_t file_comment_len(0);
257 uint16_t intern_file_attr(0);
258 uint32_t extern_file_attr(0);
259 uint16_t disk_num_start(0);
260 std::string filename;
270 zipRead(is, uncompressed_size);
277 zipRead(is, rel_offset_loc_head);
278 zipRead(is, filename, filename_len);
335 throw InvalidStateException(
"ZipCentralDirectoryEntry::write(): file name, comment, or extra field too large to save in a Zip file.");
345 throw InvalidStateException(
"ZipCentralDirectoryEntry::write(): The size of this file is too large to fit in a zip archive.");
352 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32)
357 #elif defined(__APPLE__) && defined(__MACH__)
359 writer_version |=
g_osx;
383 uint16_t filename_len(filename.length());
385 uint16_t file_comment_len(
m_comment.length());
386 uint16_t disk_num_start(0);
387 uint16_t intern_file_attr(0);
407 uint32_t extern_file_attr(
m_is_directory ? 0x41FD0010 : 0x81B40000);
StorageMethod m_compress_method
virtual size_t getHeaderSize() const override
Compute and return the current header size.
uint16_t const g_macintosh
Various exceptions used throughout the Zipios++ library, all based on zipios::Exception.
void zipRead(std::istream &is, uint32_t &value)
virtual pointer_t clone() const override
Create a clone of this Central Directory entry.
uint16_t const g_z_system
CompressionLevel m_compression_level
StorageMethod
The types used with FileEntry::setMethod and FileEntry::getMethod.
An implementation of the FileEntry for Zip archives.
dostime_t unix2dostime(time_t unix_time)
Convert a Unix date to a DOS date.
static CompressionLevel const COMPRESSION_LEVEL_NONE
uint16_t const g_alternate_vms
void zipWrite(std::ostream &os, uint32_t const &value)
dostime_t dostime(int year, int month, int day, int hour, int minute, int second)
char const g_separator
The character used as the filename separator.
An IOException is used to signal an I/O error.
ZipCentralDirectoryEntry()
Initializes a default ZipCentralDirectoryEntry object.
uint16_t const g_os2_hpfs
virtual ~ZipCentralDirectoryEntry() override
Clean up the entry.
time_t dos2unixtime(dostime_t dostime)
Convert a DOS time to a Unix time.
uint16_t const g_open_vms
A FileEntry represents an entry in a FileCollection.
Exception used when it is not possible to move forward.
uint16_t m_general_purpose_bitfield
Declaration of the zipios::ZipCentralDirectoryEntry, which represents a directory Zip archive entry...
Handle a file path and name and its statistics.
static uint16_t const g_zip_format_version
Definitions for the MS-DOS to Unix time conversions.
Various functions used throughout the library.
uint16_t const g_atari_st
size_t length() const
Get the length of the string.
uint16_t m_extract_version
virtual void write(std::ostream &os) override
Write a Central Directory Entry to the output stream.
virtual void read(std::istream &is) override
Read a Central Directory entry.
size_t m_uncompressed_size
std::streampos m_entry_offset
std::shared_ptr< FileEntry > pointer_t
uint32_t const g_signature
The signature of a ZipCentralDirectoryEntry.
uint16_t const g_acorn_risc