SafeStream
class SafeStream
internal |
Provides atomicity and isolation for thread safe file manipulation using stream safe://
file_put_contents('safe://myfile.txt', $content);
$content = file_get_contents('safe://myfile.txt');
unlink('safe://myfile.txt');
Constants
PROTOCOL |
Name of stream protocol - safe:// |
Methods
Registers protocol '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 'safe://'.
at line 65
bool
stream_open($path, $mode, $options)
Opens file.
at line 167
void
stream_close()
Closes file.
at line 193
string
stream_read($length)
Reads up to length bytes from the file.
at line 204
int
stream_write($data)
Writes the string to the file.
at line 222
bool
stream_truncate($size)
Truncates a file to a given length.
at line 232
int
stream_tell()
Returns the position of the file.
at line 242
bool
stream_eof()
Returns TRUE if the file pointer is at end-of-file.
at line 254
int
stream_seek($offset, $whence)
Sets the file position indicator for the file.
at line 264
array
stream_stat()
Gets information about a file referenced by $this->tempHandle.
at line 276
array
url_stat($path, $flags)
Gets information about a file referenced by filename.
at line 290
bool
unlink($path)
Deletes a file.
On Windows unlink is not allowed till file is opened