note 111889 added to class.streamwrapper

From: Date: Tue, 09 Apr 2013 11:02:33 +0000
Subject: note 111889 added to class.streamwrapper
Groups: php.notes 
Request: Send a blank email to php-notes+get-194403@lists.php.net to get a copy of this message
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); } ?> ---- Server IP: 69.147.83.199 Probable Submitter: 72.175.28.85 ---- Manual Page -- http://php.net/manual/en/class.streamwrapper.php Edit -- https://master.php.net/note/edit/111889 Del: integrated -- https://master.php.net/note/delete/111889/integrated Del: useless -- https://master.php.net/note/delete/111889/useless Del: bad code -- https://master.php.net/note/delete/111889/bad+code Del: spam -- https://master.php.net/note/delete/111889/spam Del: non-english -- https://master.php.net/note/delete/111889/non-english Del: in docs -- https://master.php.net/note/delete/111889/in+docs Del: other reasons-- https://master.php.net/note/delete/111889 Reject -- https://master.php.net/note/reject/111889 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#194403) next »