PROTOCOL
PROTOCOL = 'zipentry' : string
The class provides stream reuse functionality.
Stream will not be closed at {@see \PhpZip\IO\Stream\fclose}.
$context : resource
$fp : resource
stream_open(string $path, string $mode, int $options, string $opened_path) : bool
Opens file or URL.
This method is called immediately after the wrapper is initialized (f.e. by {@see \PhpZip\IO\Stream\fopen()} and {@see \PhpZip\IO\Stream\file_get_contents()}).
string | $path | specifies the URL that was passed to the original function |
string | $mode | the mode used to open the file, as detailed for {@see \PhpZip\IO\Stream\fopen()} |
int | $options | Holds additional flags set by the streams API. It can hold one or more of the following values OR'd together. |
string | $opened_path | if the path is opened successfully, and STREAM_USE_PATH is set in options, opened_path should be set to the full path of the file/resource that was actually opened |
stream_read(int $count) : false|string
Read from stream.
This method is called in response to {@see \PhpZip\IO\Stream\fread()} and {@see \PhpZip\IO\Stream\fgets()}.
Note: Remember to update the read/write position of the stream (by the number of bytes that were successfully read).
int | $count | how many bytes of data from the current position should be returned |
If there are less than count bytes available, return as many as are available. If no more data is available, return either FALSE or an empty string.
stream_seek(int $offset, int $whence = SEEK_SET) : bool
Seeks to specific location in a stream.
This method is called in response to {@see \PhpZip\IO\Stream\fseek()}. The read/write position of the stream should be updated according to the offset and whence.
int | $offset | the stream offset to seek to |
int | $whence | Possible values: {@see \SEEK_SET} - Set position equal to offset bytes. {@see \SEEK_CUR} - Set position to current location plus offset. {@see \SEEK_END} - Set position to end-of-file plus offset. |
return TRUE if the position was updated, FALSE otherwise
stream_flush() : bool
Flushes the output.
This method is called in response to {@see \PhpZip\IO\Stream\fflush()} and when the stream is being closed while any unflushed data has been written to it before. If you have cached data in your stream but not yet stored it into the underlying storage, you should do so now.
should return TRUE if the cached data was successfully stored (or if there was no data to store), or FALSE if the data could not be stored
stream_write(string $data) : int
Write to stream.
This method is called in response to {@see fwrite().}
Note: Remember to update the current position of the stream by number of bytes that were successfully written.
string | $data | should be stored into the underlying stream |
should return the number of bytes that were successfully stored, or 0 if none could be stored
stream_cast(int $cast_as) : resource
Retrieve the underlaying resource.
This method is called in response to {@see \PhpZip\IO\Stream\stream_select()}.
int | $cast_as | can be {@see \PhpZip\IO\Stream\STREAM_CAST_FOR_SELECT} when {@see \PhpZip\IO\Stream\stream_select()} is callingstream_cast() or {@see \PhpZip\IO\Stream\STREAM_CAST_AS_STREAM} when stream_cast() is called for other uses |