From 4f2c2288d0e7c6adad9d6ff54e7a4d004192b89c Mon Sep 17 00:00:00 2001 From: Sara Golemon Date: Sun, 5 Jan 2003 04:25:06 +0000 Subject: [PATCH] Changes per Wez and addition of stream_get_filters git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@110545 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../stream/functions/stream-get-filters.xml | 45 +++++++++++ .../functions/stream-register-filter.xml | 37 ++++++++- reference/stream/reference.xml | 77 ++++++++++++++----- 3 files changed, 138 insertions(+), 21 deletions(-) create mode 100644 reference/stream/functions/stream-get-filters.xml diff --git a/reference/stream/functions/stream-get-filters.xml b/reference/stream/functions/stream-get-filters.xml new file mode 100644 index 0000000000..f3d8589f1e --- /dev/null +++ b/reference/stream/functions/stream-get-filters.xml @@ -0,0 +1,45 @@ + + + + + stream_get_filters + Retrieve list of registered filters + + + Description + + arraystream_get_filters + + + + Returns an indexed array containing the name of all stream filters + available on the running system. + + + See Also: + stream_register_filter, and + stream_get_wrappers + + + + + diff --git a/reference/stream/functions/stream-register-filter.xml b/reference/stream/functions/stream-register-filter.xml index 92011dcc57..30c6e624b1 100644 --- a/reference/stream/functions/stream-register-filter.xml +++ b/reference/stream/functions/stream-register-filter.xml @@ -1,5 +1,5 @@ - + stream_register_filter @@ -45,6 +45,27 @@ so that the next filter in the chain can perform its filter. When no filters remain, the stream will write data in its final form. + + + If your filter alters the length of data, for + example by removing the first character, before passing onto + parent::write($data); it must be certain to include + that stolen character in the return count. + + + + + + + @@ -88,13 +109,23 @@ voidoncreate - + + This method is called during instantiation of the filter class + object. If your filter allocates or initializes any other resources + (such as a buffer), this is the place to do it. + voidonclose - + + This method is called upon filter shutdown (typically, this is also + during stream shutdown), and is executed after + the flush method is called. If any resources + were allocated or initialzed during oncreate + this would be the time to destroy or dispose of them. + The example below implements a filter named rot13 diff --git a/reference/stream/reference.xml b/reference/stream/reference.xml index 692d5c1dfd..6a20db885e 100644 --- a/reference/stream/reference.xml +++ b/reference/stream/reference.xml @@ -1,5 +1,5 @@ - + Stream functions Streams @@ -11,21 +11,33 @@ Streams were introduced with PHP 4.3.0 as a way of generalizing file, network, data compression, and other - opperations which share a common set of functions and uses. In - its simplest definition, a stream is any I/O conduit for exchanging - information. Some streams work on the local filesystem, some - use network connections (sockets), while others might potentially focus - on communication devices such as printers or modems. Because any variety - of stream may be added to PHP via the - stream_register_wrapper function, there is no - set limit on what can be done with them. See - for a listing of stream wrappers built into PHP. + opperations which share a common set of functions and uses. In + its simplest definition, a stream is a + resource object which exhibits streamable + behavior. That is, it can be read from or written to in a linear + fashion, and may be able to fseek to an + arbitrary locations within the stream. - In addition to streams, support for custom user filters is also available. - While a stream (such as 'http') is designed to communicate with an endpoint, - one or more filters can be placed between the stream and the application to - further process the data as it is read/written. + A wrapper is additional code which tells the stream how to handle + specific protocols/encodings. For example, the http + wrapper knows how to translate a URL into an HTTP/1.1 + request for a file on a remote server. There are many wrappers + built into PHP by default (See ), + and additional, custom wrappers may be added either within a + PHP script using stream_register_wrapper, + or directly from an extension using the . + 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 stream_get_wrappers. + + + A filter is a final piece of code which may perform + opperations on data as it is being read from or written to a stream. + Filters may be defined in a PHP script using + stream_register_filter or in an extension using the + . To access the list of currently registered filters, + use stream_get_filters. A stream is referenced as: scheme://target @@ -33,9 +45,11 @@ scheme(string) - - The name of the stream wrapper to be used. Examples include: file, + The name of the wrapper to be used. Examples include: file, http, https, ftp, ftps, compress.zlib, compress.bz2, ssl, tls, and php. See - for a list of PHP builtin wrappers. + for a list of PHP builtin wrappers. If + no wrapper is specified, the function default is used (typically + file://). @@ -43,7 +57,7 @@ target - 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 + streams this is typically a hostname, often with a path appended. Again, see for a description of targets for builtin streams. @@ -85,7 +99,34 @@
&reftitle.constants; - &no.constants; + + + + + + Constant + Description + + + + + STREAM_USE_PATH + Flag indicating if the stream + used the include path. + + + + STREAM_REPORT_ERRORS + Flag indicating if the wrapper + if responsible for raising errors using trigger_error + during opening of the stream. If this flag is not set, you + should not raise any errors. + + + + + +