ReadOnlyStream
abstract class ReadOnlyStream implements StreamWrapperInterface (View source)
Defines a read-only Drupal stream wrapper base class.
This class provides a minimal-read only stream wrapper implementation. Specifically, it only implements the writing classes and read classes where we need to restrict 'write-capable' arguments.
Drupal\Core\StreamWrapper\ReadOnlyStream implementations need to implement all the read-related classes.
Properties
| resource | $context | Stream context resource. |
|
| resource | $handle | A generic resource handle. |
|
| protected string | $uri | Instance URI (stream). |
Methods
Sets the absolute stream resource URI.
Returns the stream resource URI.
Support for fopen(), file_get_contents(), etc.
Support for flock().
Support for fwrite(), file_put_contents() etc.
Support for fflush().
Sets metadata on the stream.
Truncate stream.
Support for unlink().
Support for rename().
Support for mkdir().
Support for rmdir().
Details
setUri(string $uri)
Sets the absolute stream resource URI.
This allows you to set the URI. Generally is only called by the factory method.
string
getUri()
Returns the stream resource URI.
bool
stream_open(string $uri, string $mode, int $options, string $opened_path)
Support for fopen(), file_get_contents(), etc.
Any write modes will be rejected, as this is a read-only stream wrapper.
bool
stream_lock(int $operation)
Support for flock().
An exclusive lock attempt will be rejected, as this is a read-only stream wrapper.
int
stream_write(string $data)
Support for fwrite(), file_put_contents() etc.
Data will not be written as this is a read-only stream wrapper.
bool
stream_flush()
Support for fflush().
Nothing will be output to the file, as this is a read-only stream wrapper. However as stream_flush is called during stream_close we should not trigger an error.
bool
stream_metadata($uri, int $option, mixed $value)
Sets metadata on the stream.
bool
stream_truncate(int $new_size)
Truncate stream.
Will respond to truncation; e.g., through ftruncate().
bool
unlink(string $uri)
Support for unlink().
The file will not be deleted from the stream as this is a read-only stream wrapper.
bool
rename(string $from_uri, string $to_uri)
Support for rename().
This file will not be renamed as this is a read-only stream wrapper.
bool
mkdir(string $uri, int $mode, int $options)
Support for mkdir().
Directory will never be created as this is a read-only stream wrapper.
bool
rmdir(string $uri, int $options)
Support for rmdir().
Directory will never be deleted as this is a read-only stream wrapper.