Properties

$size

$size : int

Type

int — file size

$inStream

$inStream : resource

Type

resource

$options

$options : array

Type

array

Methods

__construct()

__construct(resource  $inStream, array  $options = []) : mixed

Parameters

resource $inStream
array $options

Returns

mixed —

read()

read() : \PhpZip\Model\ImmutableZipContainer

Throws

\PhpZip\Exception\ZipException

Returns

\PhpZip\Model\ImmutableZipContainer —

getStreamMetaData()

getStreamMetaData() : array

Returns

array —

getEntryStream()

getEntryStream(\PhpZip\Model\Data\ZipSourceFileData  $zipFileData) : resource

Parameters

\PhpZip\Model\Data\ZipSourceFileData $zipFileData

Throws

\PhpZip\Exception\ZipException
\PhpZip\Exception\Crc32Exception

Returns

resource —

copyUncompressedDataToStream()

copyUncompressedDataToStream(\PhpZip\Model\Data\ZipSourceFileData  $zipFileData, resource  $outStream) : mixed

Parameters

\PhpZip\Model\Data\ZipSourceFileData $zipFileData
resource $outStream

Throws

\PhpZip\Exception\Crc32Exception
\PhpZip\Exception\ZipException

Returns

mixed —

copyCompressedDataToStream()

copyCompressedDataToStream(\PhpZip\Model\Data\ZipSourceFileData  $zipData, resource  $outStream) : mixed

Parameters

\PhpZip\Model\Data\ZipSourceFileData $zipData
resource $outStream

Returns

mixed —

close()

close() : mixed

Returns

mixed —

__destruct()

__destruct() : mixed

Returns

mixed —

getDefaultOptions()

getDefaultOptions() : array

Returns

array —

readEndOfCentralDirectory()

readEndOfCentralDirectory() : \PhpZip\Model\EndOfCentralDirectory

Read End of central directory record.

end of central dir signature 4 bytes (0x06054b50) number of this disk 2 bytes number of the disk with the start of the central directory 2 bytes total number of entries in the central directory on this disk 2 bytes total number of entries in the central directory 2 bytes size of the central directory 4 bytes offset of start of central directory with respect to the starting disk number 4 bytes .ZIP file comment length 2 bytes .ZIP file comment (variable size)

Throws

\PhpZip\Exception\ZipException

Returns

\PhpZip\Model\EndOfCentralDirectory —

findEndOfCentralDirectory()

findEndOfCentralDirectory() : bool

Returns

bool —

findZip64ECDPosition()

findZip64ECDPosition() : int

Read Zip64 end of central directory locator and returns Zip64 end of central directory position.

number of the disk with the start of the zip64 end of central directory 4 bytes relative offset of the zip64 end of central directory record 8 bytes total number of disks 4 bytes

Throws

\PhpZip\Exception\ZipException

Returns

int —

Zip64 End Of Central Directory position

readZip64EndOfCentralDirectory()

readZip64EndOfCentralDirectory(int  $zip64ECDPosition) : \PhpZip\Model\EndOfCentralDirectory

Read zip64 end of central directory locator and zip64 end of central directory record.

zip64 end of central dir signature 4 bytes (0x06064b50) size of zip64 end of central directory record 8 bytes version made by 2 bytes version needed to extract 2 bytes number of this disk 4 bytes number of the disk with the start of the central directory 4 bytes total number of entries in the central directory on this disk 8 bytes total number of entries in the central directory 8 bytes size of the central directory 8 bytes offset of start of central directory with respect to the starting disk number 8 bytes zip64 extensible data sector (variable size)

Parameters

int $zip64ECDPosition

Throws

\PhpZip\Exception\ZipException

Returns

\PhpZip\Model\EndOfCentralDirectory —

readCentralDirectory()

readCentralDirectory(\PhpZip\Model\EndOfCentralDirectory  $endCD) : \PhpZip\Model\ZipEntry[]

Reads the central directory from the given seekable byte channel and populates the internal tables with ZipEntry instances.

The ZipEntry's will know all data that can be obtained from the central directory alone, but not the data that requires the local file header or additional data to be read.

Parameters

\PhpZip\Model\EndOfCentralDirectory $endCD

Throws

\PhpZip\Exception\ZipException

Returns

\PhpZip\Model\ZipEntry[] —

readZipEntry()

readZipEntry(resource  $stream) : \PhpZip\Model\ZipEntry

Read central directory entry.

central file header signature 4 bytes (0x02014b50) version made by 2 bytes version needed to extract 2 bytes general purpose bit flag 2 bytes compression method 2 bytes last mod file time 2 bytes last mod file date 2 bytes crc-32 4 bytes compressed size 4 bytes uncompressed size 4 bytes file name length 2 bytes extra field length 2 bytes file comment length 2 bytes disk number start 2 bytes internal file attributes 2 bytes external file attributes 4 bytes relative offset of local header 4 bytes

file name (variable size) extra field (variable size) file comment (variable size)

Parameters

resource $stream

Throws

\PhpZip\Exception\ZipException

Returns

\PhpZip\Model\ZipEntry —

parseExtraFields()

parseExtraFields(string  $buffer, \PhpZip\Model\ZipEntry  $zipEntry, bool  $local = false) : \PhpZip\Model\Extra\ExtraFieldsCollection

Parameters

string $buffer
\PhpZip\Model\ZipEntry $zipEntry
bool $local

Returns

\PhpZip\Model\Extra\ExtraFieldsCollection —

handleZip64Extra()

handleZip64Extra(\PhpZip\Model\Extra\Fields\Zip64ExtraField  $extraZip64, \PhpZip\Model\ZipEntry  $zipEntry) : mixed

Parameters

\PhpZip\Model\Extra\Fields\Zip64ExtraField $extraZip64
\PhpZip\Model\ZipEntry $zipEntry

Returns

mixed —

loadLocalExtraFields()

loadLocalExtraFields(\PhpZip\Model\ZipEntry  $entry) : mixed

Read Local File Header.

local file header signature 4 bytes (0x04034b50) version needed to extract 2 bytes general purpose bit flag 2 bytes compression method 2 bytes last mod file time 2 bytes last mod file date 2 bytes crc-32 4 bytes compressed size 4 bytes uncompressed size 4 bytes file name length 2 bytes extra field length 2 bytes file name (variable size) extra field (variable size)

Parameters

\PhpZip\Model\ZipEntry $entry

Throws

\PhpZip\Exception\ZipException

Returns

mixed —

handleExtraFields()

handleExtraFields(\PhpZip\Model\ZipEntry  $zipEntry) : mixed

Handle extra data in zip records.

This is a special method in which you can process ExtraField and make changes to ZipEntry.

Parameters

\PhpZip\Model\ZipEntry $zipEntry

Returns

mixed —

isZip64Support()

isZip64Support() : bool

Returns

bool —

handleExtraEncryptionFields()

handleExtraEncryptionFields(\PhpZip\Model\ZipEntry  $zipEntry) : mixed

Parameters

\PhpZip\Model\ZipEntry $zipEntry

Throws

\PhpZip\Exception\ZipException

Returns

mixed —