/** * Process the raw data from a binary stream * * @param Woops_Zip_Binary_Stream The binary stream * @return void */ public function processData(Woops_Zip_Binary_Stream $stream) { $this->_madeByVersion = $stream->littleEndianUnsignedShort(); $this->_extractVersion = $stream->littleEndianUnsignedShort(); $this->_flags = $stream->littleEndianUnsignedShort(); $this->_compressionMethod = $stream->littleEndianUnsignedShort(); $this->_mTime = $stream->littleEndianUnsignedShort(); $this->_mDate = $stream->littleEndianUnsignedShort(); $this->_crc32 = $stream->littleEndianUnsignedLong(); $this->_compressedSize = $stream->littleEndianUnsignedLong(); $this->_uncompressedSize = $stream->littleEndianUnsignedLong(); $fileNameLength = $stream->littleEndianUnsignedShort(); $extraFieldLength = $stream->littleEndianUnsignedShort(); $fileCommentLength = $stream->littleEndianUnsignedShort(); $this->_diskNumberStart = $stream->littleEndianUnsignedShort(); $this->_internalFileAttributes = $stream->littleEndianUnsignedShort(); $this->_externalFileAttributes = $stream->littleEndianUnsignedLong(); $this->_localHeaderOffset = $stream->littleEndianUnsignedLong(); $this->_fileName = $stream->read($fileNameLength); $this->_processExtraField($stream, $extraFieldLength); $this->_fileComment = $stream->read($fileCommentLength); }
/** * Process the raw data from a binary stream * * @param Woops_Zip_Binary_Stream The binary stream * @return void */ public function processData(Woops_Zip_Binary_Stream $stream) { // Resets the digital signature $this->_digitalSignature = NULL; // Signature of the central file headers $fileHeaderSignature = chr(0x50) . chr(0x4b) . chr(0x1) . chr(0x2); // Gets the central file header signature $signature = $stream->read(4); // Checks the central file header signature if ($signature !== $fileHeaderSignature) { // Error - Invalid central file header signature throw new Woops_Zip_Central_Directory_Exception('Invalid central file header signature', Woops_Zip_Central_Directory_Exception::EXCEPTION_BAD_FILE_HEADER_SIGNATURE); } // Processes the central file headers while ($signature === $fileHeaderSignature) { // Creates and stores the central file header object $fileHeader = new Woops_Zip_Central_File_Header(); $this->_centralFileHeaders[] = $fileHeader; // Processes the central file header data $fileHeader->processData($stream); // Gets the next 4 bytes, to find an additionnal signature $signature = $stream->read(4); } // Checks for a digital signature if ($signature === chr(0x50) . chr(0x4b) . chr(0x5) . chr(0x5)) { // Creates the digital signature $this->_digitalSignature = new Woops_Zip_Digital_Signature(); // Process the digital signature data $this->_digitalSignature->processData($stream); // Gets the next 4 bytes, to find an additionnal signature $signature = $stream->read(4); } else { // Rewinds the stream $stream->seek(-4, Woops_Zip_Binary_Stream::SEEK_CUR); } }
/** * Process the raw data from a binary stream * * @param Woops_Zip_Binary_Stream The binary stream * @return void */ public function processData(Woops_Zip_Binary_Stream $stream) { $length = $stream->littleEndianUnsignedShort(); $this->_data = $stream->read($length); }
/** * Process the raw data from a binary stream * * @param Woops_Zip_Binary_Stream The binary stream * @return void */ public function processData(Woops_Zip_Binary_Stream $stream) { $this->_extractVersion = $stream->littleEndianUnsignedShort(); $this->_flags = $stream->littleEndianUnsignedShort(); $this->_compressionMethod = $stream->littleEndianUnsignedShort(); $this->_mTime = $stream->littleEndianUnsignedShort(); $this->_mDate = $stream->littleEndianUnsignedShort(); $this->_crc32 = $stream->littleEndianUnsignedLong(); $this->_compressedSize = $stream->littleEndianUnsignedLong(); $this->_uncompressedSize = $stream->littleEndianUnsignedLong(); $fileNameLength = $stream->littleEndianUnsignedShort(); $extraFieldLength = $stream->littleEndianUnsignedShort(); $this->_fileName = $stream->read($fileNameLength); $this->_processExtraField($stream, $extraFieldLength); }