STREAMWRAPPER(3) 1 STREAMWRAPPER(3)
The streamWrapper class
INTRODUCTION
Allows you to implement your own protocol handlers and streams for use with all the other filesystem functions (such as fopen(3), fread(3)
etc.).
Note
This is NOT a real class, only a prototype of how a class defining its own protocol should be.
Note
Implementing the methods in other ways then described here can lead to undefined behaviour.
An instance of this class is initialized as soon as a stream function tries to access the protocol it is associated with.
CLASS SYNOPSIS
streamWrapper
streamWrapper
Properties
o public resource$context
Methods
o
streamWrapper::__construct (void )
o
streamWrapper::__destruct (void )
o public bool streamWrapper::dir_closedir (void )
o public bool streamWrapper::dir_opendir (string $path, int $options)
o public string streamWrapper::dir_readdir (void )
o public bool streamWrapper::dir_rewinddir (void )
o public bool streamWrapper::mkdir (string $path, int $mode, int $options)
o public bool streamWrapper::rename (string $path_from, string $path_to)
o public bool streamWrapper::rmdir (string $path, int $options)
o public resource streamWrapper::stream_cast (int $cast_as)
o public void streamWrapper::stream_close (void )
o public bool streamWrapper::stream_eof (void )
o public bool streamWrapper::stream_flush (void )
o public bool streamWrapper::stream_lock (int $operation)
o public bool streamWrapper::stream_metadata (string $path, int $option, mixed $value)
o public bool streamWrapper::stream_open (string $path, string $mode, int $options, string &$opened_path)
o public string streamWrapper::stream_read (int $count)
o public bool streamWrapper::stream_seek (int $offset, int $whence = SEEK_SET)
o public bool streamWrapper::stream_set_option (int $option, int $arg1, int $arg2)
o public array streamWrapper::stream_stat (void )
o public int streamWrapper::stream_tell (void )
o public bool streamWrapper::stream_truncate (int $new_size)
o public int streamWrapper::stream_write (string $data)
o public bool streamWrapper::unlink (string $path)
o public array streamWrapper::url_stat (string $path, int $flags)
PROPERTIES
o resource $context
- The current context, or NULL if no context was passed to the caller function. Use the stream_context_get_options(3) to parse
the context.
Note
This property must be public so PHP can populate it with the actual context resource.
CHANGELOG
+--------+------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+------------------------------+
| 5.0.0 | |
| | |
| | Added the context property. |
| | |
+--------+------------------------------+
SEE ALSO
o"Example class registered as stream wrapper"
ostream_wrapper_register(3)
ostream_wrapper_unregister(3)
ostream_wrapper_restore(3)
PHP Documentation Group STREAMWRAPPER(3)