<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/refs.basic.other.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'book.stream.php',
    1 => 'ストリーム',
    2 => 'ストリーム',
  ),
  'up' => 
  array (
    0 => 'refs.basic.other.php',
    1 => 'その他の基本モジュール',
  ),
  'prev' => 
  array (
    0 => 'function.spl-object-id.php',
    1 => 'spl_object_id',
  ),
  'next' => 
  array (
    0 => 'stream.setup.php',
    1 => 'インストール/設定',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/stream/book.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/book.stream.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="book.stream" class="book">
 
 <h1 class="title">ストリーム</h1>

  <div id="intro.stream" class="preface">
   <h1 class="title">はじめに</h1>
   <p class="simpara">
    ストリームは、
    ファイル、ネットワーク、データ圧縮などに関する、
    共通した一連の関数群と利用法を持つ操作の一般化の手法です。
    もっとも単純な定義では、<code class="literal">ストリーム</code>
    というのは、ストリーミング可能な動作を体現する <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span>
    オブジェクトといえます。つまり、ストリームには線的に読み出したり、
    あるいは書き込んだりすることが可能で、かつ、
    ストリーム上の任意の場所に <span class="function"><a href="function.fseek.php" class="function">fseek()</a></span> できる場合もあります。
   </p>
   <p class="simpara">
    <code class="literal">ラッパー</code> というのは、ストリームにおいてどのように特定の
    プロトコル/エンコーディングを扱うかを扱うかを指示する付加的なコード
    です。たとえば、<code class="literal">http</code> ラッパーは、どのようにして
    URL を、リモートサーバーのファイルに対する <code class="literal">HTTP/1.0</code>
    リクエストに転換するかを知っています。PHP
    には、デフォルトで組み込まれているラッパーが多数存在しますが
    (<a href="wrappers.php" class="xref">サポートするプロトコル/ラッパー</a> を参照ください)、
    それに加え、カスタムラッパーを<span class="function"><a href="function.stream-wrapper-register.php" class="function">stream_wrapper_register()</a></span>
    を利用して PHP スクリプトの内部から、あるいはストリーム API を用いて、
    直接拡張モジュールの内部から追加できます。
    あらゆる種類のラッパーが PHP に追加できるので、
    特にラッパーでできることの限界はありません。
    現在登録されているラッパーの種類を知るには、
    <span class="function"><a href="function.stream-get-wrappers.php" class="function">stream_get_wrappers()</a></span> を使います。
   </p>
   <p class="para">
    リソースは次のような形でストリームとして参照されます: <code class="parameter">scheme</code>://<code class="parameter">target</code>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       <code class="parameter">scheme</code>(string) -
       使用されるラッパーの名称です。例として、
       <code class="literal">file</code>, <code class="literal">http</code>, <code class="literal">https</code>,
       <code class="literal">ftp</code>, <code class="literal">ftps</code>,
       <code class="literal">compress.zlib</code>, <code class="literal">compress.bz2</code>,
       <code class="literal">php</code> などが含まれます。
       PHP 組み込みのラッパーについては、<a href="wrappers.php" class="xref">サポートするプロトコル/ラッパー</a>
       を参照ください。もしラッパーが指定されていない場合は、使用している関数の
       デフォルトが利用されます(通常は <code class="literal">file</code>://)。
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       <code class="parameter">target</code> - 
       使用するラッパーによって解釈が異なります。
       ファイルシステムに関連したストリームの場合、
       一般的にこのパラメータは対象となるファイルの
       ファイル名とパスを表します。
       ネットワークに関連したストリームの場合、一般的に
       このパラメータはホスト名と、(多くの場合付加されるはずの) パス名です。
       PHP 組み込みのラッパーに、どのようにターゲットが解釈されるかは、
       <a href="wrappers.php" class="xref">サポートするプロトコル/ラッパー</a> を参照ください。
      </span>
     </li>
    </ul>
   </p>
  </div>

 








 







 







 

 





  



 







 

 








 






 








 








 
<ul class="chunklist chunklist_book"><li><a href="stream.setup.php">インストール/設定</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="stream.resources.php">ストリームのクラス</a></li></ul></li><li><a href="stream.constants.php">定義済み定数</a></li><li><a href="stream.filters.php">ストリームフィルタ</a></li><li><a href="stream.contexts.php">ストリームコンテキスト</a></li><li><a href="stream.errors.php">ストリームのエラー</a></li><li><a href="stream.examples.php">例</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="stream.streamwrapper.example-1.php">ストリームラッパーとして登録するクラスの例</a></li></ul></li><li><a href="class.php-user-filter.php">php_user_filter</a> — php_user_filter クラス<ul class="chunklist chunklist_book chunklist_children"><li><a href="php-user-filter.filter.php">php_user_filter::filter</a> — フィルタを適用するときにコールされる</li><li><a href="php-user-filter.onclose.php">php_user_filter::onClose</a> — フィルタを閉じるときにコールされる</li><li><a href="php-user-filter.oncreate.php">php_user_filter::onCreate</a> — フィルタを作成するときにコールされる</li></ul></li><li><a href="class.streamwrapper.php">streamWrapper</a> — streamWrapper クラス<ul class="chunklist chunklist_book chunklist_children"><li><a href="streamwrapper.construct.php">streamWrapper::__construct</a> — 新しいストリームラッパーを作成する</li><li><a href="streamwrapper.destruct.php">streamWrapper::__destruct</a> — 既存のストリームラッパーを破棄する</li><li><a href="streamwrapper.dir-closedir.php">streamWrapper::dir_closedir</a> — ディレクトリハンドルを閉じる</li><li><a href="streamwrapper.dir-opendir.php">streamWrapper::dir_opendir</a> — ディレクトリハンドルをオープンする</li><li><a href="streamwrapper.dir-readdir.php">streamWrapper::dir_readdir</a> — ディレクトリハンドルからエントリを読み込む</li><li><a href="streamwrapper.dir-rewinddir.php">streamWrapper::dir_rewinddir</a> — ディレクトリハンドルを巻き戻す</li><li><a href="streamwrapper.mkdir.php">streamWrapper::mkdir</a> — ディレクトリを作成する</li><li><a href="streamwrapper.rename.php">streamWrapper::rename</a> — ファイルあるいはディレクトリの名前を変える</li><li><a href="streamwrapper.rmdir.php">streamWrapper::rmdir</a> — ディレクトリを削除する</li><li><a href="streamwrapper.stream-cast.php">streamWrapper::stream_cast</a> — 元となるリソースを取得する</li><li><a href="streamwrapper.stream-close.php">streamWrapper::stream_close</a> — リソースを閉じる</li><li><a href="streamwrapper.stream-eof.php">streamWrapper::stream_eof</a> — ファイルポインタが終端にあるかどうかを調べる</li><li><a href="streamwrapper.stream-flush.php">streamWrapper::stream_flush</a> — 出力をフラッシュする</li><li><a href="streamwrapper.stream-lock.php">streamWrapper::stream_lock</a> — ファイルのアドバイザリ・ロック</li><li><a href="streamwrapper.stream-metadata.php">streamWrapper::stream_metadata</a> — ストリームメタデータを変更する</li><li><a href="streamwrapper.stream-open.php">streamWrapper::stream_open</a> — ファイルあるいは URL をオープンする</li><li><a href="streamwrapper.stream-read.php">streamWrapper::stream_read</a> — ストリームから読み込む</li><li><a href="streamwrapper.stream-seek.php">streamWrapper::stream_seek</a> — ストリーム内の特定の場所に移動する</li><li><a href="streamwrapper.stream-set-option.php">streamWrapper::stream_set_option</a> — ストリームのオプションを変更する</li><li><a href="streamwrapper.stream-stat.php">streamWrapper::stream_stat</a> — ファイルリソースについての情報を取得する</li><li><a href="streamwrapper.stream-tell.php">streamWrapper::stream_tell</a> — ストリームの現在位置を取得する</li><li><a href="streamwrapper.stream-truncate.php">streamWrapper::stream_truncate</a> — ストリームを丸める</li><li><a href="streamwrapper.stream-write.php">streamWrapper::stream_write</a> — ストリームに書き込む</li><li><a href="streamwrapper.unlink.php">streamWrapper::unlink</a> — ファイルを削除する</li><li><a href="streamwrapper.url-stat.php">streamWrapper::url_stat</a> — ファイルについての情報を取得する</li></ul></li><li><a href="ref.stream.php">ストリーム 関数</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="function.stream-bucket-append.php">stream_bucket_append</a> — bucket を brigade に追加する</li><li><a href="function.stream-bucket-make-writeable.php">stream_bucket_make_writeable</a> — 操作する brigade から bucket オブジェクトを返す</li><li><a href="function.stream-bucket-new.php">stream_bucket_new</a> — 現在のストリームで使用する新しい bucket を作成する</li><li><a href="function.stream-bucket-prepend.php">stream_bucket_prepend</a> — bucket を brigade の先頭に追加する</li><li><a href="function.stream-context-create.php">stream_context_create</a> — ストリームコンテキストを作成する</li><li><a href="function.stream-context-get-default.php">stream_context_get_default</a> — デフォルトのストリームコンテキストを取得する</li><li><a href="function.stream-context-get-options.php">stream_context_get_options</a> — ストリーム / ラッパー / コンテキストに設定されているオプションを取得する</li><li><a href="function.stream-context-get-params.php">stream_context_get_params</a> — コンテキストのパラメータを取得する</li><li><a href="function.stream-context-set-default.php">stream_context_set_default</a> — デフォルトのストリームコンテキストを設定する</li><li><a href="function.stream-context-set-option.php">stream_context_set_option</a> — ストリーム / ラッパー / コンテキストのオプションを設定する</li><li><a href="function.stream-context-set-options.php">stream_context_set_options</a> — 指定されたコンテキストのオプションを設定する</li><li><a href="function.stream-context-set-params.php">stream_context_set_params</a> — ストリーム / ラッパー / コンテキストのパラメータを設定する</li><li><a href="function.stream-copy-to-stream.php">stream_copy_to_stream</a> — データをあるストリームから別のストリームにコピーする</li><li><a href="function.stream-filter-append.php">stream_filter_append</a> — ストリームにフィルタを付加する</li><li><a href="function.stream-filter-prepend.php">stream_filter_prepend</a> — フィルタをストリームに付加する</li><li><a href="function.stream-filter-register.php">stream_filter_register</a> — ユーザー定義のストリームフィルタを登録する</li><li><a href="function.stream-filter-remove.php">stream_filter_remove</a> — ストリームからフィルタを取り除く</li><li><a href="function.stream-get-contents.php">stream_get_contents</a> — 残りのストリームを文字列に読み込む</li><li><a href="function.stream-get-filters.php">stream_get_filters</a> — 登録されているフィルタのリストを取得する</li><li><a href="function.stream-get-line.php">stream_get_line</a> — 指定されたデリミタの位置までのデータを一行分としてストリームから読み込む</li><li><a href="function.stream-get-meta-data.php">stream_get_meta_data</a> — ヘッダーあるいはメタデータをストリームまたはファイルポインタから取得する</li><li><a href="function.stream-get-transports.php">stream_get_transports</a> — 登録されたソケットのトランスポートの一覧を取得する</li><li><a href="function.stream-get-wrappers.php">stream_get_wrappers</a> — 登録されているストリームのラッパーのリストを取得する</li><li><a href="function.stream-is-local.php">stream_is_local</a> — ローカルストリームかどうかを調べる</li><li><a href="function.stream-isatty.php">stream_isatty</a> — ストリームがターミナル型のデバイスかを調べる</li><li><a href="function.stream-notification-callback.php">stream_notification_callback</a> — notification コンテキストパラメータ用のコールバック関数</li><li><a href="function.stream-register-wrapper.php">stream_register_wrapper</a> — stream_wrapper_register のエイリアス</li><li><a href="function.stream-resolve-include-path.php">stream_resolve_include_path</a> — インクルードパスに対してファイル名を解決する</li><li><a href="function.stream-select.php">stream_select</a> — select() システムコールと同等の操作を、
   ストリームの配列に対して seconds と microseconds で指定されたタイムアウト時間をもって行う</li><li><a href="function.stream-set-blocking.php">stream_set_blocking</a> — ストリームのブロックモードを有効にする / 解除する</li><li><a href="function.stream-set-chunk-size.php">stream_set_chunk_size</a> — ストリームのチャンクサイズを設定する</li><li><a href="function.stream-set-read-buffer.php">stream_set_read_buffer</a> — 指定したストリームのファイル読み込みバッファリングを有効にする</li><li><a href="function.stream-set-timeout.php">stream_set_timeout</a> — ストリームにタイムアウトを設定する</li><li><a href="function.stream-set-write-buffer.php">stream_set_write_buffer</a> — 指定されたストリームのファイル書き込みバッファリングを有効にする</li><li><a href="function.stream-socket-accept.php">stream_socket_accept</a> — stream_socket_server で作られたソケットの接続を受け入れる</li><li><a href="function.stream-socket-client.php">stream_socket_client</a> — インターネットドメインまたは Unix ドメインのソケット接続を開く</li><li><a href="function.stream-socket-enable-crypto.php">stream_socket_enable_crypto</a> — 接続済みのソケットについて暗号化の on/off を切り替える</li><li><a href="function.stream-socket-get-name.php">stream_socket_get_name</a> — ローカルまたはリモートのソケットの名前を取得する</li><li><a href="function.stream-socket-pair.php">stream_socket_pair</a> — 接続された、区別できないソケットストリームの組を作成する</li><li><a href="function.stream-socket-recvfrom.php">stream_socket_recvfrom</a> — 接続されているかどうかにかかわらず、ソケットからのデータを受信する</li><li><a href="function.stream-socket-sendto.php">stream_socket_sendto</a> — 接続されているかどうかにかかわらず、ソケットにデータを送信する</li><li><a href="function.stream-socket-server.php">stream_socket_server</a> — インターネットドメインまたは Unix ドメインのサーバーソケットを作成する</li><li><a href="function.stream-socket-shutdown.php">stream_socket_shutdown</a> — 全二重接続を終了する</li><li><a href="function.stream-supports-lock.php">stream_supports_lock</a> — ストリームがロックをサポートしているかどうかを調べる</li><li><a href="function.stream-wrapper-register.php">stream_wrapper_register</a> — PHP のクラスとして実装された URL ラッパーを登録する</li><li><a href="function.stream-wrapper-restore.php">stream_wrapper_restore</a> — 事前に登録を解除された組み込みラッパーを復元する</li><li><a href="function.stream-wrapper-unregister.php">stream_wrapper_unregister</a> — URL ラッパーの登録を解除する</li></ul></li></ul></div><?php manual_footer($setup); ?>