Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 1058

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The streamWrapper class</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="php-user-filter.oncreate.html">php_user_filter::onCreate</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="streamwrapper.construct.html">streamWrapper::__construct</a></div>
 <div class="up"><a href="book.stream.html">Streams</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="class.streamwrapper" class="reference">

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

 <div class="partintro"><p class="verinfo">(PHP 4 &gt;= 4.3.2, PHP 5)</p>


  <div class="section" id="streamwrapper.intro">
   <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  <span class="function"><a href="function.fopen.html" class="function">fopen()</a></span>,
     <span class="function"><a href="function.fread.html" class="function">fread()</a></span> etc.).
   </p>
   <blockquote class="note"><p><strong class="note">Note</strong>: 
    <p class="para">
     This is <em class="emphasis">NOT</em> a real class, only a prototype of how
     a class defining its own protocol should be. 
    </p>
   </p></blockquote>
   <blockquote class="note"><p><strong class="note">Note</strong>: 
    <p class="para">
     Implementing the methods in other ways then described here can lead to
     undefined behaviour.
    </p>
   </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 class="section" id="streamwrapper.synopsis">
   <h2 class="title">Class synopsis</h2>


   <div class="classsynopsis">
    <div class="ooclass"></div>


    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="replaceable">streamWrapper</span>
     </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.html#streamwrapper.props.context">$<var class="varname">context</var></a></var>
    ;</div>


    
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div>
    <div class="methodsynopsis dc-description">
    <span class="methodname"><a href="streamwrapper.construct.html" class="methodname">__construct</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
    <span class="methodname"><a href="streamwrapper.destruct.html" class="methodname">__destruct</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.html" class="methodname">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.html" class="methodname">dir_opendir</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$path</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code></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.html" class="methodname">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.html" class="methodname">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.html" class="methodname">mkdir</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$path</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$mode</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="streamwrapper.rename.html" class="methodname">rename</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$path_from</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$path_to</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="streamwrapper.rmdir.html" class="methodname">rmdir</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$path</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code></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.html" class="methodname">stream_cast</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$cast_as</code></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.html" class="methodname">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.html" class="methodname">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.html" class="methodname">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.html" class="methodname">stream_lock</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$operation</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="streamwrapper.stream-metadata.html" class="methodname">stream_metadata</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$path</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$option</code></span>
   , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$value</code></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.html" class="methodname">stream_open</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$path</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$mode</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter reference">&$opened_path</code></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.html" class="methodname">stream_read</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$count</code></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.html" class="methodname">stream_seek</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$offset</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$whence</code> <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.html" class="methodname">stream_set_option</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$option</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$arg1</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$arg2</code></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.html" class="methodname">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.html" class="methodname">stream_tell</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-truncate.html" class="methodname">stream_truncate</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$new_size</code></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.html" class="methodname">stream_write</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="streamwrapper.unlink.html" class="methodname">unlink</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$path</code></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.html" class="methodname">url_stat</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$path</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code></span>
   )</div>

   }</div>


  </div>

  

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

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

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

    </dt>

   </dl>

  </div>


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

     </thead>

     <tbody class="tbody">
      <tr>
       <td>5.0.0</td>
       <td>
        Added the <em>context</em> property.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>

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

 </div>

 



















































































































































 




























<h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="streamwrapper.construct.html">streamWrapper::__construct</a> — Constructs a new stream wrapper</li><li><a href="streamwrapper.destruct.html">streamWrapper::__destruct</a> — Destructs an existing stream wrapper</li><li><a href="streamwrapper.dir-closedir.html">streamWrapper::dir_closedir</a> — Close directory handle</li><li><a href="streamwrapper.dir-opendir.html">streamWrapper::dir_opendir</a> — Open directory handle</li><li><a href="streamwrapper.dir-readdir.html">streamWrapper::dir_readdir</a> — Read entry from directory handle</li><li><a href="streamwrapper.dir-rewinddir.html">streamWrapper::dir_rewinddir</a> — Rewind directory handle</li><li><a href="streamwrapper.mkdir.html">streamWrapper::mkdir</a> — Create a directory</li><li><a href="streamwrapper.rename.html">streamWrapper::rename</a> — Renames a file or directory</li><li><a href="streamwrapper.rmdir.html">streamWrapper::rmdir</a> — Removes a directory</li><li><a href="streamwrapper.stream-cast.html">streamWrapper::stream_cast</a> — Retrieve the underlaying resource</li><li><a href="streamwrapper.stream-close.html">streamWrapper::stream_close</a> — Close an resource</li><li><a href="streamwrapper.stream-eof.html">streamWrapper::stream_eof</a> — Tests for end-of-file on a file pointer</li><li><a href="streamwrapper.stream-flush.html">streamWrapper::stream_flush</a> — Flushes the output</li><li><a href="streamwrapper.stream-lock.html">streamWrapper::stream_lock</a> — Advisory file locking</li><li><a href="streamwrapper.stream-metadata.html">streamWrapper::stream_metadata</a> — Change stream options</li><li><a href="streamwrapper.stream-open.html">streamWrapper::stream_open</a> — Opens file or URL</li><li><a href="streamwrapper.stream-read.html">streamWrapper::stream_read</a> — Read from stream</li><li><a href="streamwrapper.stream-seek.html">streamWrapper::stream_seek</a> — Seeks to specific location in a stream</li><li><a href="streamwrapper.stream-set-option.html">streamWrapper::stream_set_option</a> — Change stream options</li><li><a href="streamwrapper.stream-stat.html">streamWrapper::stream_stat</a> — Retrieve information about a file resource</li><li><a href="streamwrapper.stream-tell.html">streamWrapper::stream_tell</a> — Retrieve the current position of a stream</li><li><a href="streamwrapper.stream-truncate.html">streamWrapper::stream_truncate</a> — Truncate stream</li><li><a href="streamwrapper.stream-write.html">streamWrapper::stream_write</a> — Write to stream</li><li><a href="streamwrapper.unlink.html">streamWrapper::unlink</a> — Delete a file</li><li><a href="streamwrapper.url-stat.html">streamWrapper::url_stat</a> — Retrieve information about a file</li></ul>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="php-user-filter.oncreate.html">php_user_filter::onCreate</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="streamwrapper.construct.html">streamWrapper::__construct</a></div>
 <div class="up"><a href="book.stream.html">Streams</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>