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);
250 uint32_t dosdatetime(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);
337 throw InvalidStateException(
"ZipCentralDirectoryEntry::write(): file name, comment, or extra field too large to save in a Zip file.");
347 throw InvalidStateException(
"ZipCentralDirectoryEntry::write(): The size of this file is too large to fit in a zip archive.");
354 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) 358 #elif defined(__APPLE__) && defined(__MACH__) 360 writer_version |=
g_osx;
386 uint16_t filename_len(filename.length());
388 uint16_t file_comment_len(
m_comment.length());
389 uint16_t disk_num_start(0);
390 uint16_t intern_file_attr(0);
410 uint32_t extern_file_attr(
m_is_directory ? 0x41FD0010 : 0x81B40000);
Define a type to manage date and time in MS-DOS format.
std::time_t getUnixTimestamp() const
Retrieve the DOSDateTime as a Unix timestamp.
StorageMethod m_compress_method
The zipios namespace includes the Zipios library definitions.
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.
dosdatetime_t getDOSDateTime() const
Retrieve the DOSDateTime value as is.
void setUnixTimestamp(std::time_t unix_timestamp)
Set the DOSDateTime value from a Unix timestamp.
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.
static CompressionLevel const COMPRESSION_LEVEL_NONE
uint16_t const g_alternate_vms
void zipWrite(std::ostream &os, uint32_t const &value)
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.
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
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
void setDOSDateTime(dosdatetime_t datetime)
Set the DOSDateTime value as is.
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