<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.streamwrapper.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'streamwrapper.stream-read.php',
    1 => 'streamWrapper::stream_read',
    2 => 'ストリームから読み込む',
  ),
  'up' => 
  array (
    0 => 'class.streamwrapper.php',
    1 => 'streamWrapper',
  ),
  'prev' => 
  array (
    0 => 'streamwrapper.stream-open.php',
    1 => 'streamWrapper::stream_open',
  ),
  'next' => 
  array (
    0 => 'streamwrapper.stream-seek.php',
    1 => 'streamWrapper::stream_seek',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/stream/streamwrapper/stream-read.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="streamwrapper.stream-read" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">streamWrapper::stream_read</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.2, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">streamWrapper::stream_read</span> &mdash; <span class="dc-title">ストリームから読み込む</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-streamwrapper.stream-read-description">
  <h3 class="title">説明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>streamWrapper::stream_read</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$count</code></span>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   このメソッドは、<span class="function"><a href="function.fread.php" class="function">fread()</a></span>
   および <span class="function"><a href="function.fgets.php" class="function">fgets()</a></span> に対応してコールされます。
  </p>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    ストリームの読み込み/書き込み位置
    (読み込みに成功したバイト数ぶん) の更新を忘れないようにしましょう。
   </p>
  </p></blockquote>

 </div>


 <div class="refsect1 parameters" id="refsect1-streamwrapper.stream-read-parameters">
  <h3 class="title">パラメータ</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">count</code></dt>
     <dd>
      <p class="para">
       現在位置から何バイトぶんのデータを返すか。
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-streamwrapper.stream-read-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="para">
   <code class="parameter">count</code> バイト未満のデータしか存在しない場合は、
   返せる限りのデータを返します。もうデータがない場合は、空文字列を返します。
   読み込みが失敗した場合は、<strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> を返します。
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-streamwrapper.stream-read-errors">
  <h3 class="title">エラー / 例外</h3>
  <p class="para">このメソッドのコールに
(未実装などの理由で) 失敗した場合、
<strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> を発行します。</p>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    戻り値が <code class="parameter">count</code> より長い場合は
    <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> エラーが発生し、余分なデータは失われます。
   </p>
  </p></blockquote>
 </div>

 



 <div class="refsect1 notes" id="refsect1-streamwrapper.stream-read-notes">
  <h3 class="title">注意</h3>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    <span class="methodname"><a href="streamwrapper.stream-eof.php" class="methodname">streamWrapper::stream_eof()</a></span> は、
    <span class="methodname"><strong>streamWrapper::stream_read()</strong></span> がコールされた後に直接コールされ、
    <abbr title="End Of File">EOF</abbr> に達したかどうかを調べます。実装されていない場合は
    <abbr title="End Of File">EOF</abbr> だとみなされます。
   </p>
  </p></blockquote>
  <div class="warning"><strong class="warning">警告</strong>
    <p class="para">
      ファイル全体を (<span class="function"><a href="function.file-get-contents.php" class="function">file_get_contents()</a></span> などで)
      読み込む場合、PHP はループ内で
      <span class="methodname"><strong>streamWrapper::stream_read()</strong></span> をコールしてから
      <span class="methodname"><a href="streamwrapper.stream-eof.php" class="methodname">streamWrapper::stream_eof()</a></span> をコールします。
      しかし、<span class="methodname"><strong>streamWrapper::stream_read()</strong></span>
      が空でない文字列を返す限りは
      <span class="methodname"><a href="streamwrapper.stream-eof.php" class="methodname">streamWrapper::stream_eof()</a></span>
      の戻り値を無視します。
    </p>
  </div>
 </div>

 
 <div class="refsect1 seealso" id="refsect1-streamwrapper.stream-read-seealso">
  <h3 class="title">参考</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.fread.php" class="function" rel="rdfs-seeAlso">fread()</a> - バイナリセーフなファイルの読み込み</span></li>
    <li><span class="function"><a href="function.fgets.php" class="function" rel="rdfs-seeAlso">fgets()</a> - ファイルポインタから 1 行取得する</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>