public static function createDirEntry($path, $timestamp)
 {
     $fileEntry = new ZipFileEntry();
     $fileEntry->gzType = 0;
     $fileEntry->gpFlags = 0;
     $fileEntry->fileCRC32 = 0;
     $fileEntry->externalFileAttributes = ZipFileEntry::EXT_FILE_ATTR_DIR;
     $fileEntry->gzLength = 0;
     $fileEntry->dataLength = 0;
     $fileEntry->isDirectory = true;
     $fileEntry->dosTime = ZipUtils::getDosTime($timestamp);
     $fileEntry->path = $path;
     $ef = new ExtendedTimeStampExtraField();
     $ef->setModTime($timestamp);
     $ef->setAccessTime($timestamp);
     $fileEntry->addExtraField($ef);
     $ef = new GenericExtraField();
     $ef->header = AbstractExtraField::HEADER_UNIX_TYPE_3;
     $ef->setFieldData("è", '');
     $fileEntry->addExtraField($ef);
     return $fileEntry;
 }
 private function processStream($handle, $subPath = '')
 {
     $pkHeader = null;
     do {
         $curPos = ftell($handle);
         $pkHeader = AbstractZipHeader::seekPKHeader($handle);
         if ($pkHeader === false || feof($handle)) {
             break;
         }
         $pkPos = ftell($handle);
         if ($curPos < $pkPos) {
             $this->_throwException(new HeaderPositionError(array('expected' => $curPos, 'actual' => $pkPos)));
         }
         if ($pkHeader === AbstractZipHeader::ZIP_CENTRAL_FILE_HEADER) {
             $fileEntry = $this->FILES[$this->CDRindex++];
             /* @var $fileEntry ZipFileEntry */
             $fileEntry->parseHeader($handle);
         } else {
             if ($pkHeader === AbstractZipHeader::ZIP_LOCAL_FILE_HEADER) {
                 $fileEntry = new ZipFileEntry($handle);
                 $this->FILES[$this->LFHindex++] = $fileEntry;
                 $fileEntry->prependPath($subPath);
                 $lf = $fileEntry->getLocalHeader();
                 $lfLen = ZipUtils::bin_strlen($lf);
                 $this->zipWrite($lf);
                 fseek($handle, $fileEntry->offset + $fileEntry->dataOffset, SEEK_SET);
                 if (!$fileEntry->isDirectory) {
                     $len = $fileEntry->gzLength;
                     while ($len >= $this->streamChunkSize) {
                         $data = fread($handle, $this->streamChunkSize);
                         $this->zipWrite($data);
                         $len -= $this->streamChunkSize;
                     }
                     $data = fread($handle, $len);
                     $this->zipWrite($data);
                 }
                 $fileEntry->offset = $this->entryOffset;
                 $this->entryOffset += $lfLen + $fileEntry->gzLength;
             } else {
                 if ($pkHeader === AbstractZipHeader::ZIP_END_OF_CENTRAL_DIRECTORY) {
                     fread($handle, 4);
                     $this->eocd = new EndOfCentralDirectory($handle);
                 }
             }
         }
     } while (!feof($handle));
 }