Methods |
abstract
public
|
stream_cast(int $cast_as): resource|false
Retrieve the underlying resource
Retrieve the underlying resource
This method is called in response to {@see stream_select()}.
Parameters
$cast_as |
Can be {@see \STREAM_CAST_FOR_SELECT} when
{@see stream_select()} is calling stream_cast() or
{@see \STREAM_CAST_AS_STREAM} when stream_cast() is called for other
uses.
|
Returns
The underlying stream resource used by the
wrapper, or false .
Implemented by
|
#
|
abstract
public
|
stream_close(): void
Close a resource
Close a resource
This method is called in response to {@see fclose()}.
All resources that were locked, or allocated, by the wrapper should be
released.
Implemented by
|
#
|
abstract
public
|
stream_eof(): bool
Tests for end-of-file on a file pointer
Tests for end-of-file on a file pointer
This method is called in response to {@see feof()}.
Returns
true if the read/write position is at the end of the
stream and if no more data is available to be read, or false otherwise.
Implemented by
|
#
|
abstract
public
|
stream_flush(): bool
Flushes the output
Flushes the output
This method is called in response to {@see 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.
Returns
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.
Implemented by
|
#
|
abstract
public
|
stream_metadata(string $path, int $option, mixed $value): bool
Change stream metadata
Change stream metadata
This method is called to set metadata on the stream. It is called when
one of the following functions is called on a stream URL:
- {@see touch()}
- {@see chmod()}
- {@see chown()}
- {@see chgrp()}
Parameters
$path |
The file path or URL to set metadata. Note that in
the case of a URL, it must be a :// delimited URL. Other URL forms are
not supported.
|
$option |
One of:
|
$value |
If option is
|
Returns
true on success or false on failure. If option is
not implemented, false should be returned.
Implemented by
|
#
|
abstract
public
|
stream_open(string $path, string $mode, int $options, string|null &$opened_path): bool
Opens file or URL
Opens file or URL
This method is called immediately after the wrapper is initialized (e.g.
by {@see fopen()} and {@see file_get_contents()}).
Parameters
$path |
Specifies the URL that was passed to the original
function. Only URLs delimited by :// are supported.
|
$mode |
The mode used to open the file, as detailed for
{@see fopen()}.
|
$options |
Holds additional flags set by the streams API. It can
hold one or more of the following values OR'd together.
|
$opened_path |
If the path is opened successfully,
and {@see \STREAM_USE_PATH} is set in options , opened_path
should be set to the full path of the file/resource that was actually
opened.
|
Returns
true on success or false on failure.
Implemented by
|
#
|
abstract
public
|
stream_read(int $count): string|false
Read from stream
Read from stream
This method is called in response to {@see fread()} and {@see fgets()}.
Remember to update the read/write position of the stream (by the number
of bytes that were successfully read).
Parameters
$count |
How many bytes of data from the current position should
be returned.
|
Returns
If there are less than count bytes available,
as many as are available should be returned. If no more data is
available, an empty string should be returned. To signal that reading
failed, false should be returned.
Implemented by
|
#
|
abstract
public
|
stream_seek(int $offset, int $whence = SEEK_SET): bool
Seeks to specific location in a stream
Seeks to specific location in a stream
This method is called in response to {@see fseek()}.
Parameters
$offset |
The stream offset to seek to.
|
$whence |
Possible values:
|
Returns
true if the position was updated, false otherwise.
Implemented by
|
#
|
abstract
public
|
stream_set_option(int $option, int $arg1, int $arg2): bool
Change stream options
Parameters
$option |
One of:
|
$arg1 |
If option is
|
$arg2 |
If option is
|
Returns
true on success or false on failure. If option is
not implemented, false should be returned.
Implemented by
|
#
|
abstract
public
|
stream_stat(): mixed[]|false
Retrieve information about a file resource
Retrieve information about a file resource
This method is called in response to {@see fstat()}.
Implemented by
|
#
|
abstract
public
|
stream_tell(): int
Retrieve the current position of a stream
Retrieve the current position of a stream
This method is called in response to {@see fseek()}.
Implemented by
|
#
|
abstract
public
|
stream_truncate(int $new_size): bool
Truncate stream
Truncate stream
This method is called in response to {@see ftruncate()}.
Returns
true on success or false on failure.
Implemented by
|
#
|
abstract
public
|
stream_write(string $data): int
Write to stream
Write to stream
This method is called in response to {@see fwrite()}.
Remember to update the current position of the stream by number of
bytes that were successfully written.
Parameters
$data |
Should be stored into the underlying stream. If there
is not enough room in the underlying stream, store as much as possible.
|
Returns
The number of bytes that were successfully stored, or 0 if
none could be stored.
Implemented by
|
#
|
abstract
public
|
url_stat(string $path, int $flags): mixed[]|false
Retrieve information about a file
Retrieve information about a file
This method is called in response to all {@see stat()} related functions.
Parameters
$path |
The file path or URL to stat. Note that in the case
of a URL, it must be a :// delimited URL. Other URL forms are not
supported.
|
$flags |
Holds additional flags set by the streams API. It can
hold one or more of the following values OR'd together.
|
Returns
false on failure, otherwise an array with the
same elements returned by {@see stat()}. Unknown or unavailable values
should be set to a rational value (usually 0 ). Special attention should
be paid to mode as documented under {@see stat()}.
Implemented by
|
#
|