note 111889 deleted from class.streamwrapper by aharvey
| From: | aharvey@php.net | Date: | Wed, 10 Apr 2013 00:53:32 +0000 |
| Subject: | note 111889 deleted from class.streamwrapper by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-194418@lists.php.net to get a copy of this message | ||
Note Submitter: contact at nullivex dot com
----
I have created a few libraries for helping deal with implementing stream wrappers and takes a lot of
the work out of it.
They can be checked out on github search for "openlss/lib-stream-wrapper"
Also available for composer under "openlss/lib-stream-wrapper"
Here is an updated and much more complete interface.
<?php
//---------------------------------------------------------
//Interface to Force the PHP Stream Wrapper prototype
//---------------------------------------------------------
interface WrapperInterface {
/**
* resource context
*
* @var resource
*/
//public $context;
/**
* constructor
*
*/
public function __construct();
/**
* Close directory handle
*
* @return bool
*/
public function dir_closedir();
/**
* Open directory handle
*
* @param string $path
* @param int $options
* @return bool
*/
public function dir_opendir($path,$options);
/**
* Read entry from directory handle
* Should return the next file name
*
* @return string
*/
public function dir_readdir();
/**
* Rewind directory handle
*
* @return bool
*/
public function dir_rewinddir();
/**
* Create directory from path
*
* @param string $path
* @param int $mode
* @param int $options
* @return bool
*/
public function mkdir($path,$mode,$options);
/**
* Rename a file or directory
*
* @param string $path_from
* @param string $path_to
* @return bool
*/
public function rename($path_from,$path_to);
/**
* Remove directory by path
*
* @param string $path
* @param int $options
* @return bool
*/
public function rmdir($path,$options);
/**
* Return underlying stream resource
*
* @param int $cast_as
* @return resource
*/
public function stream_cast($cast_as);
/**
* Close stream handle (flush buffers/cache)
*
*/
public function stream_close();
/**
* Check for end of file
*
* @return bool
*/
public function stream_eof();
/**
* Force buffer flush
*
* @return bool
*/
public function stream_flush();
/**
* Advisory file locking
*
* @param mode $operation
* @return bool
*/
public function stream_lock($operation);
/**
* Open stream resource by path
*
* @param string $path
* @param string $mode
* @param int $options
* @param string &$opened_path
* @return bool
*/
public function stream_open($path,$mode,$options,&$opened_path);
/**
* Read $count bytes from resource
*
* @param int $count
* @return string
*/
public function stream_read($count);
/**
* Seek to new position in resource
*
* @param int $offset
* @param int $whence = SEEK_SET
* @return bool
*/
public function stream_seek($offset,$whence=SEEK_SET);
/**
* Set options for the stream
*
* @param int $option
* @param int $arg1
* @param int $arg2
* @return bool
*/
public function stream_set_option($option,$arg1,$arg2);
/**
* Return stats about the stream
*
* @return array
*/
public function stream_stat();
/**
* Return the current pointer position
*
* @return int
*/
public function stream_tell();
/**
* Write $data to the stream and return $int bytes written
*
* @param string $data
* @return int
*/
public function stream_write($data);
/**
* Remove entry by path
*
* @param string $path
* @return bool
*/
public static function unlink($path);
/**
* Return information about a path
*
* @param string $path
* @param int $flags
* @return array
*/
public static function url_stat($path , $flags);
}
?>