php-doc-en/reference/stream/book.xml
2013-05-23 17:38:21 +00:00

99 lines
3.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<book xml:id="book.stream" xmlns="http://docbook.org/ns/docbook">
<?phpdoc extension-membership="core" ?>
<title>Streams</title>
<preface xml:id="intro.stream">
&reftitle.intro;
<simpara>
Streams were introduced with PHP 4.3.0 as
a way of generalizing file, network, data compression, and other
operations which share a common set of functions and uses. In
its simplest definition, a <literal>stream</literal> is a
<literal>resource</literal> object which exhibits streamable
behavior. That is, it can be read from or written to in a linear
fashion, and may be able to <function>fseek</function> to an
arbitrary locations within the stream.
</simpara>
<simpara>
A <literal>wrapper</literal> is additional code which tells the stream how to handle
specific protocols/encodings. For example, the <literal>http</literal>
wrapper knows how to translate a URL into an <literal>HTTP/1.0</literal>
request for a file on a remote server. There are many wrappers
built into PHP by default (See <xref linkend="wrappers"/>),
and additional, custom wrappers may be added either within a
PHP script using <function>stream_wrapper_register</function>,
or directly from an extension using the API Reference in <xref linkend="internals2.streams"/>.
Because any variety of wrapper may be added to PHP,
there is no set limit on what can be done with them. To access the list
of currently registered wrappers, use <function>stream_get_wrappers</function>.
</simpara>
<para>
A stream is referenced as: <parameter>scheme</parameter>://<parameter>target</parameter>
<itemizedlist>
<listitem>
<simpara>
<parameter>scheme</parameter>(string) -
The name of the wrapper to be used. Examples include: file,
http, https, ftp, ftps, compress.zlib, compress.bz2, and php. See
<xref linkend="wrappers"/> for a list of PHP built-in wrappers. If
no wrapper is specified, the function default is used (typically
<literal>file</literal>://).
</simpara>
</listitem>
<listitem>
<simpara>
<parameter>target</parameter> -
Depends on the wrapper used. For filesystem related streams this is
typically a path and filename of the desired file. For network related
streams this is typically a hostname, often with a path appended. Again, see
<xref linkend="wrappers"/> for a description of targets for built-in streams.
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
<note>
<para>
Information on using streams within the PHP source code can be found in the
<link linkend="internals2.ze1.streams">Streams API for PHP Extension Authors reference</link>.
</para>
</note>
</para>
</preface>
&reference.stream.setup;
&reference.stream.constants;
&reference.stream.filters;
&reference.stream.contexts;
&reference.stream.errors;
&reference.stream.examples;
&reference.stream.php-user-filter;
&reference.stream.streamwrapper;
&reference.stream.reference;
</book>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->