downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/class.streamwrapper.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/book.stream.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'class.streamwrapper.php',
   
1 => 'streamWrapper',
  ),
 
'up' =>
  array (
   
0 => 'book.stream.php',
   
1 => 'Streams',
  ),
 
'prev' =>
  array (
   
0 => 'stream.streamwrapper.example-1.php',
   
1 => 'Example class registered as stream wrapper',
  ),
 
'next' =>
  array (
   
0 => 'streamwrapper.construct.php',
   
1 => 'streamWrapper::__construct',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div>

 <h1 class="title">The streamWrapper class</h1>
 

 <div class="partintro">


  <div id="streamwrapper.intro" class="section">
   <h2 class="title">Introduction</h2>
   <p class="para">
    Allows you to implement your own protocol handlers and streams for use
    with all the other filesystem functions (such as <a href="function.fopen.php" class="function">fopen()</a>,
    <a href="function.fread.php" class="function">fread()</a> etc.).
   </p>
   <blockquote><p><b class="note">Note</b>:
   
     This is <em class="emphasis">NOT</em> a real class, only a prototype of how
     a class defining its own protocol should be.
    <br />
   </p></blockquote>
   <blockquote><p><b class="note">Note</b>:
   
     Implementing the methods in other ways then described here can lead to
     undefined behaviour.
    <br />
   </p></blockquote>
   <p class="para">
    An instance of this class is initialized as soon as a stream function
    tries to access the protocol it is associated with.
   </p>
  </div>


  <div id="streamwrapper.synopsis" class="section">
   <h2 class="title">Class synopsis</h2>


   <div class="classsynopsis">
    <div class="ooclass"><b class="classname">streamWrapper</b></div>


    <div class="classsynopsisinfo">
     <span class="ooclass">
      <b class="classname">streamWrapper</b>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Properties */</div>
    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="type">resource</span>
      <var class="varname"><a href="class.streamwrapper.php#streamwrapper.props.context">$context</a></var>
    ;</div>


   
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div>
    <div class="methodsynopsis dc-description">
    <span class="methodname"><a href="streamwrapper.construct.php" class="function">__construct</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="streamwrapper.dir-closedir.php" class="function">dir_closedir</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="streamwrapper.dir-opendir.php" class="function">dir_opendir</a></span>
    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$path</tt></span>
   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$options</tt></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><a href="streamwrapper.dir-readdir.php" class="function">dir_readdir</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="streamwrapper.dir-rewinddir.php" class="function">dir_rewinddir</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="streamwrapper.mkdir.php" class="function">mkdir</a></span>
    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$path</tt></span>
   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$mode</tt></span>
   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$options</tt></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="streamwrapper.rename.php" class="function">rename</a></span>
    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$path_from</tt></span>
   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$path_to</tt></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="streamwrapper.rmdir.php" class="function">rmdir</a></span>
    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$path</tt></span>
   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$options</tt></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">resource</span> <span class="methodname"><a href="streamwrapper.stream-cast.php" class="function">stream_cast</a></span>
    ( <span class="methodparam"><span class="type">int</span> <tt class="parameter">$cast_as</tt></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="streamwrapper.stream-close.php" class="function">stream_close</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="streamwrapper.stream-eof.php" class="function">stream_eof</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="streamwrapper.stream-flush.php" class="function">stream_flush</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="streamwrapper.stream-lock.php" class="function">stream_lock</a></span>
    ( <span class="methodparam"><span class="type"><span class="type mode">mode</span></span> <tt class="parameter">$operation</tt></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="streamwrapper.stream-open.php" class="function">stream_open</a></span>
    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$path</tt></span>
   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$mode</tt></span>
   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$options</tt></span>
   , <span class="methodparam"><span class="type">string</span> <tt class="parameter reference">&amp;$opened_path</tt></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><a href="streamwrapper.stream-read.php" class="function">stream_read</a></span>
    ( <span class="methodparam"><span class="type">int</span> <tt class="parameter">$count</tt></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="streamwrapper.stream-seek.php" class="function">stream_seek</a></span>
    ( <span class="methodparam"><span class="type">int</span> <tt class="parameter">$offset</tt></span>
   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$whence</tt> <span class="initializer"> = SEEK_SET</span></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="streamwrapper.stream-set-option.php" class="function">stream_set_option</a></span>
    ( <span class="methodparam"><span class="type">int</span> <tt class="parameter">$option</tt></span>
   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$arg1</tt></span>
   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$arg2</tt></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><a href="streamwrapper.stream-stat.php" class="function">stream_stat</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><a href="streamwrapper.stream-tell.php" class="function">stream_tell</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><a href="streamwrapper.stream-write.php" class="function">stream_write</a></span>
    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$data</tt></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="streamwrapper.unlink.php" class="function">unlink</a></span>
    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$path</tt></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><a href="streamwrapper.url-stat.php" class="function">url_stat</a></span>
    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$path</tt></span>
   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$flags</tt></span>
   )</div>

   }</div>


  </div>

 

  <div id="streamwrapper.props" class="section">
   <h2 class="title">Properties</h2>
   <dl>

    <dt id="streamwrapper.props.context" class="varlistentry">
     <span class="term">resource <var class="varname">context</var></span>

     </dt><dd class="listitem">

      <p class="para">
       The current <a href="context.php" class="link">context</a>, or <b><tt class="constant">NULL</tt></b> if no
       context was passed to the caller function.
      </p>
      <p class="para">
       Use the <a href="function.stream-context-get-options.php" class="function">stream_context_get_options()</a> to parse the
       context.
      </p>
      <blockquote><p><b class="note">Note</b>:
      
        This property <em class="emphasis">must</em> be public so PHP can populate
        it with the actual context resource.
       <br />
      </p></blockquote>
     </dd>

   
   </dl>

  </div>


 <div class="section">
  <h2 class="title">Changelog</h2>
  <p class="para">
   </p><table class="doctable informaltable">
   
     <thead valign="middle">
      <tr valign="middle">
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody valign="middle" class="tbody">
      <tr valign="middle">
       <td align="left">5.0.0</td>
       <td align="left">
        Added the <i>context</i> property.
       </td>
      </tr>

     </tbody>
   
   </table>
<p>
  </p>
 </div>

 <div class="section">
  <h2 class="title">See Also</h2>
  <p class="para">
   </p><ul class="simplelist">
    <li class="member"><a href="stream.streamwrapper.example-1.php" class="xref">Example class registered as stream wrapper</a></li>
    <li class="member"><a href="function.stream-wrapper-register.php" class="function">stream_wrapper_register()</a></li>
    <li class="member"><a href="function.stream-wrapper-unregister.php" class="function">stream_wrapper_unregister()</a></li>
    <li class="member"><a href="function.stream-wrapper-restore.php" class="function">stream_wrapper_restore()</a></li>
   </ul><p>
  </p>
 </div>

 </div>

 



























































































































































<h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="streamwrapper.construct.php">streamWrapper::__construct</a> — Constructs a new stream wrapper</li><li><a href="streamwrapper.dir-closedir.php">streamWrapper::dir_closedir</a> — Close directory handle</li><li><a href="streamwrapper.dir-opendir.php">streamWrapper::dir_opendir</a> — Open directory handle</li><li><a href="streamwrapper.dir-readdir.php">streamWrapper::dir_readdir</a> — Read entry from directory handle</li><li><a href="streamwrapper.dir-rewinddir.php">streamWrapper::dir_rewinddir</a> — Rewind directory handle</li><li><a href="streamwrapper.mkdir.php">streamWrapper::mkdir</a> — Create a directory</li><li><a href="streamwrapper.rename.php">streamWrapper::rename</a> — Renames a file or directory</li><li><a href="streamwrapper.rmdir.php">streamWrapper::rmdir</a> — Removes a directory</li><li><a href="streamwrapper.stream-cast.php">streamWrapper::stream_cast</a> — Retrieve the underlaying resource</li><li><a href="streamwrapper.stream-close.php">streamWrapper::stream_close</a> — Close an resource</li><li><a href="streamwrapper.stream-eof.php">streamWrapper::stream_eof</a> — Tests for end-of-file on a file pointer</li><li><a href="streamwrapper.stream-flush.php">streamWrapper::stream_flush</a> — Flushes the output</li><li><a href="streamwrapper.stream-lock.php">streamWrapper::stream_lock</a> — Advisory file locking</li><li><a href="streamwrapper.stream-open.php">streamWrapper::stream_open</a> — Opens file or URL</li><li><a href="streamwrapper.stream-read.php">streamWrapper::stream_read</a> — Read from stream</li><li><a href="streamwrapper.stream-seek.php">streamWrapper::stream_seek</a> — Seeks to specific location in a stream</li><li><a href="streamwrapper.stream-set-option.php">streamWrapper::stream_set_option</a> — Change stream options</li><li><a href="streamwrapper.stream-stat.php">streamWrapper::stream_stat</a> — Retrieve information about a file resource</li><li><a href="streamwrapper.stream-tell.php">streamWrapper::stream_tell</a> — Retrieve the current position of a stream</li><li><a href="streamwrapper.stream-write.php">streamWrapper::stream_write</a> — Write to stream</li><li><a href="streamwrapper.unlink.php">streamWrapper::unlink</a> — Delete a file</li><li><a href="streamwrapper.url-stat.php">streamWrapper::url_stat</a> — Retrieve information about a file</li></ul>
</div>
<?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites