SafeStream
class SafeStream
internal |
Provides atomicity and 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->tempHandle.
Gets information about a file referenced by filename.
Deletes a file.
Details
at line 51
static bool
register()
Registers protocol 'nette.safe://'.
at line 68
bool
stream_open($path, $mode, $options)
Opens file.
at line 170
void
stream_close()
Closes file.
at line 196
string
stream_read($length)
Reads up to length bytes from the file.
at line 207
int
stream_write($data)
Writes the string to the file.
at line 225
bool
stream_truncate($size)
Truncates a file to a given length.
at line 235
int
stream_tell()
Returns the position of the file.
at line 245
bool
stream_eof()
Returns true if the file pointer is at end-of-file.
at line 257
int
stream_seek($offset, $whence)
Sets the file position indicator for the file.
at line 267
array
stream_stat()
Gets information about a file referenced by $this->tempHandle.
at line 279
array
url_stat($path, $flags)
Gets information about a file referenced by filename.
at line 293
bool
unlink($path)
Deletes a file.
On Windows unlink is not allowed till file is opened