SafeStream
class SafeStream
internal |
Provides isolation for thread safe file manipulation using stream nette.safe://
file_put_contents('nette.safe://myfile.txt', $content);
$content = file_get_contents('nette.safe://myfile.txt');
unlink('nette.safe://myfile.txt');
Constants
PROTOCOL |
Name of stream protocol - nette.safe:// |
Methods
Registers protocol 'nette.safe://'.
Opens file.
Closes file.
Reads up to length bytes from the file.
Writes the string to the file.
Truncates a file to a given length.
Returns the position of the file.
Returns true if the file pointer is at end-of-file.
Sets the file position indicator for the file.
Gets information about a file referenced by $this->handle.
Gets information about a file referenced by filename.
Deletes a file.
Does nothing, but since PHP 7.4 needs to be implemented when using wrapper for includes
Details
at line 46
static bool
register()
Registers protocol 'nette.safe://'.
at line 60
bool
stream_open(string $path, string $mode, int $options)
Opens file.
at line 98
void
stream_close()
Closes file.
at line 112
stream_read(int $length)
Reads up to length bytes from the file.
at line 121
stream_write(string $data)
Writes the string to the file.
at line 137
bool
stream_truncate(int $size)
Truncates a file to a given length.
at line 146
int
stream_tell()
Returns the position of the file.
at line 155
bool
stream_eof()
Returns true if the file pointer is at end-of-file.
at line 164
bool
stream_seek(int $offset, int $whence = SEEK_SET)
Sets the file position indicator for the file.
at line 173
stream_stat()
Gets information about a file referenced by $this->handle.
at line 182
url_stat(string $path, int $flags)
Gets information about a file referenced by filename.
at line 194
bool
unlink(string $path)
Deletes a file.
On Windows unlink is not allowed till file is opened
at line 204
bool
stream_set_option(int $option, int $arg1, int $arg2)
Does nothing, but since PHP 7.4 needs to be implemented when using wrapper for includes