<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.event.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'class.eventbuffer.php',
    1 => 'EventBuffer',
    2 => 'The EventBuffer class',
  ),
  'up' => 
  array (
    0 => 'book.event.php',
    1 => 'Event',
  ),
  'prev' => 
  array (
    0 => 'eventbase.stop.php',
    1 => 'EventBase::stop',
  ),
  'next' => 
  array (
    0 => 'eventbuffer.add.php',
    1 => 'EventBuffer::add',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/event/eventbuffer.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/class.eventbuffer.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="class.eventbuffer" class="reference">
 <h1 class="title">The EventBuffer class</h1>
 
 <div class="partintro"><p class="verinfo">(PECL event &gt;= 1.5.0)</p>

  <div class="section" id="eventbuffer.intro">
   <h2 class="title">はじめに</h2>
   <p class="para">
    <span class="classname"><strong class="classname">EventBuffer</strong></span>
    represents Libevent&#039;s &quot;evbuffer&quot;, an utility functionality for buffered
    I/O.
   </p>
   <p class="para">
    Event buffers are meant to be generally useful for doing the &quot;buffer&quot; part
    of buffered network I/O.
   </p>
  </div>

  <div class="section" id="eventbuffer.synopsis">
   <h2 class="title">クラス概要</h2>


   <div class="classsynopsis">
    <span class="ooclass">
     <strong class="classname"></strong>
    </span>

    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">class</span> <strong class="classname">EventBuffer</strong>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 定数 */</div>
    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.eventbuffer.php#eventbuffer.constants.eol-any"><var class="varname">EOL_ANY</var></a></var><span class="initializer"> = 0</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.eventbuffer.php#eventbuffer.constants.eol-crlf"><var class="varname">EOL_CRLF</var></a></var><span class="initializer"> = 1</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.eventbuffer.php#eventbuffer.constants.eol-crlf-strict"><var class="varname">EOL_CRLF_STRICT</var></a></var><span class="initializer"> = 2</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.eventbuffer.php#eventbuffer.constants.eol-lf"><var class="varname">EOL_LF</var></a></var><span class="initializer"> = 3</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.eventbuffer.php#eventbuffer.constants.ptr-set"><var class="varname">PTR_SET</var></a></var><span class="initializer"> = 0</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.eventbuffer.php#eventbuffer.constants.ptr-add"><var class="varname">PTR_ADD</var></a></var><span class="initializer"> = 1</span>;</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* プロパティ */</div>
    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="varname"><a href="class.eventbuffer.php#eventbuffer.props.length">$<var class="varname">length</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="varname"><a href="class.eventbuffer.php#eventbuffer.props.contiguous-space">$<var class="varname">contiguous_space</var></a></var>;</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* メソッド */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.add.php" class="methodname">add</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$data</code>
   </span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.addbuffer.php" class="methodname">addBuffer</a></span>(<span class="methodparam">
    
    <span class="type"><a href="class.eventbuffer.php" class="type EventBuffer">EventBuffer</a></span> <code class="parameter">$buf</code>
   </span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.appendfrom.php" class="methodname">appendFrom</a></span>(<span class="methodparam">
    
    <span class="type"><a href="class.eventbuffer.php" class="type EventBuffer">EventBuffer</a></span> <code class="parameter">$buf</code>
   </span>, <span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$len</code>
   </span>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.construct.php" class="methodname">__construct</a></span>()</div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.copyout.php" class="methodname">copyout</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter reference">&$data</code>
   </span>, <span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$max_bytes</code>
   </span>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.drain.php" class="methodname">drain</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$len</code>
   </span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.enablelocking.php" class="methodname">enableLocking</a></span>(): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.expand.php" class="methodname">expand</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$len</code>
   </span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.freeze.php" class="methodname">freeze</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$at_front</code>
   </span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.lock.php" class="methodname">lock</a></span>(): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.prepend.php" class="methodname">prepend</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$data</code>
   </span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.prependbuffer.php" class="methodname">prependBuffer</a></span>(<span class="methodparam">
    
    <span class="type"><a href="class.eventbuffer.php" class="type EventBuffer">EventBuffer</a></span> <code class="parameter">$buf</code>
   </span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.pullup.php" class="methodname">pullup</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$size</code>
   </span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.read.php" class="methodname">read</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$max_bytes</code>
   </span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.read.php" class="methodname">read</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$fd</code>
   </span>, <span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$howmuch</code>
   </span>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.readline.php" class="methodname">readLine</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$eol_style</code>
   </span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.search.php" class="methodname">search</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$what</code>
   </span>, <span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$start</code>
    <span class="initializer"> = -1</span>
   </span>, <span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$end</code>
    <span class="initializer"> = -1</span>
   </span>): <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.searcheol.php" class="methodname">searchEol</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$start</code>
    <span class="initializer"> = -1</span>
   </span>, <span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$eol_style</code>
    <span class="initializer"> = 
     <strong><code><a href="class.eventbuffer.php#eventbuffer.constants.eol-any">EventBuffer::EOL_ANY</a></code></strong>
    </span>
   </span>): <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.substr.php" class="methodname">substr</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$start</code>
   </span>, <span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$length</code>
   <span class="initializer"> = ?</span></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.unfreeze.php" class="methodname">unfreeze</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$at_front</code>
   </span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.unlock.php" class="methodname">unlock</a></span>(): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="eventbuffer.write.php" class="methodname">write</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$fd</code>
   </span>, <span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$howmuch</code>
   <span class="initializer"> = ?</span></span>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

   }</div>

  </div>

  <div class="section" id="eventbuffer.props">
   <h2 class="title">プロパティ</h2>
   <dl>
    
     <dt id="eventbuffer.props.length">
      <var class="varname">length</var>
     </dt>
     <dd>
      <p class="para">
       The number of bytes stored in an event buffer.
      </p>
     </dd>
    
    
     <dt id="eventbuffer.props.contiguous-space">
      <var class="varname">contiguous_space</var>
     </dt>
     <dd>
      <p class="para">
       The number of bytes stored contiguously at the front of the buffer. The
       bytes in a buffer may be stored in multiple separate chunks of memory;
       the property returns the number of bytes currently stored in the first
       chunk.
      </p>
     </dd>
    
   </dl>
  </div>


  <div class="section" id="eventbuffer.constants">
   <h2 class="title">定義済み定数</h2>
   <dl>
    
     <dt id="eventbuffer.constants.eol-any">
      <strong><code><a href="class.eventbuffer.php#eventbuffer.constants.eol-any">EventBuffer::EOL_ANY</a></code></strong>
     </dt>
     <dd>
      <p class="para">
       The end of line is any sequence of any number of carriage return and
       linefeed characters. This format is not very useful; it exists mainly
       for backward compatibility.
      </p>
     </dd>
    
    
     <dt id="eventbuffer.constants.eol-crlf">
      <strong><code><a href="class.eventbuffer.php#eventbuffer.constants.eol-crlf">EventBuffer::EOL_CRLF</a></code></strong>
     </dt>
     <dd>
      <p class="para">
       The end of the line is an optional carriage return, followed by a
       linefeed. (In other words, it is either a
       <code class="literal">&quot;\r\n&quot;</code>
       or a
       <code class="literal">&quot;\n&quot;</code>
       .) This format is useful in parsing text-based Internet protocols,
       since the standards generally prescribe a
       <code class="literal">&quot;\r\n&quot;</code>
       line-terminator, but nonconformant clients sometimes say just
       <code class="literal">&quot;\n&quot;</code>.
      </p>
     </dd>
    
    
     <dt id="eventbuffer.constants.eol-crlf-strict">
      <strong><code><a href="class.eventbuffer.php#eventbuffer.constants.eol-crlf-strict">EventBuffer::EOL_CRLF_STRICT</a></code></strong>
     </dt>
     <dd>
      <p class="para">
       The end of a line is a single carriage return, followed by a single
       linefeed. (This is also known as
       <code class="literal">&quot;\r\n&quot;</code>.
       The ASCII values are
       <code class="literal">0x0D</code>
       <code class="literal">0x0A</code>
       ).
      </p>
     </dd>
    
    
     <dt id="eventbuffer.constants.eol-lf">
      <strong><code><a href="class.eventbuffer.php#eventbuffer.constants.eol-lf">EventBuffer::EOL_LF</a></code></strong>
     </dt>
     <dd>
      <p class="para">
       The end of a line is a single linefeed character. (This is also known
       as
       <code class="literal">&quot;\n&quot;</code>.
       It is ASCII value is
       <code class="literal">0x0A</code>
       .)
      </p>
     </dd>
    
    
     <dt id="eventbuffer.constants.ptr-set">
      <strong><code><a href="class.eventbuffer.php#eventbuffer.constants.ptr-set">EventBuffer::PTR_SET</a></code></strong>
     </dt>
     <dd>
      <p class="para">
       Flag used as argument of
       <span class="methodname"><strong>EventBuffer::setPosition()</strong></span>
       method. If this flag specified, the position pointer is moved to an
       absolute position within the buffer.
      </p>
     </dd>
    
    
     <dt id="eventbuffer.constants.ptr-add">
      <strong><code><a href="class.eventbuffer.php#eventbuffer.constants.ptr-add">EventBuffer::PTR_ADD</a></code></strong>
     </dt>
     <dd>
      <p class="para">
       The same as
       <strong><code><a href="class.eventbuffer.php#eventbuffer.constants.ptr-set">EventBuffer::PTR_SET</a></code></strong>,
       except this flag causes
       <span class="methodname"><strong>EventBuffer::setPosition()</strong></span>
       method to move position forward up to the specified number of
       bytes(instead of setting absolute position).
      </p>
     </dd>
    
   </dl>
  </div>

 </div>

 














































































































<h2>目次</h2><ul class="chunklist chunklist_reference"><li><a href="eventbuffer.add.php">EventBuffer::add</a> — Append data to the end of an event buffer</li><li><a href="eventbuffer.addbuffer.php">EventBuffer::addBuffer</a> — Move all data from a buffer provided to the current instance of EventBuffer</li><li><a href="eventbuffer.appendfrom.php">EventBuffer::appendFrom</a> — Moves the specified number of bytes from a source buffer to the
  end of the current buffer</li><li><a href="eventbuffer.construct.php">EventBuffer::__construct</a> — Constructs EventBuffer object</li><li><a href="eventbuffer.copyout.php">EventBuffer::copyout</a> — Copies out specified number of bytes from the front of the buffer</li><li><a href="eventbuffer.drain.php">EventBuffer::drain</a> — Removes specified number of bytes from the front of the buffer
  without copying it anywhere</li><li><a href="eventbuffer.enablelocking.php">EventBuffer::enableLocking</a> — 説明</li><li><a href="eventbuffer.expand.php">EventBuffer::expand</a> — Reserves space in buffer</li><li><a href="eventbuffer.freeze.php">EventBuffer::freeze</a> — Prevent calls that modify an event buffer from succeeding</li><li><a href="eventbuffer.lock.php">EventBuffer::lock</a> — Acquires a lock on buffer</li><li><a href="eventbuffer.prepend.php">EventBuffer::prepend</a> — Prepend data to the front of the buffer</li><li><a href="eventbuffer.prependbuffer.php">EventBuffer::prependBuffer</a> — Moves all data from source buffer to the front of current buffer</li><li><a href="eventbuffer.pullup.php">EventBuffer::pullup</a> — Linearizes data within buffer
  and returns it's contents as a string</li><li><a href="eventbuffer.read.php">EventBuffer::read</a> — Read data from an evbuffer and drain the bytes read</li><li><a href="eventbuffer.readfrom.php">EventBuffer::readFrom</a> — Read data from a file onto the end of the buffer</li><li><a href="eventbuffer.readline.php">EventBuffer::readLine</a> — Extracts a line from the front of the buffer</li><li><a href="eventbuffer.search.php">EventBuffer::search</a> — Scans the buffer for an occurrence of a string</li><li><a href="eventbuffer.searcheol.php">EventBuffer::searchEol</a> — Scans the buffer for an occurrence of an end of line</li><li><a href="eventbuffer.substr.php">EventBuffer::substr</a> — Substracts a portion of the buffer data</li><li><a href="eventbuffer.unfreeze.php">EventBuffer::unfreeze</a> — Re-enable calls that modify an event buffer</li><li><a href="eventbuffer.unlock.php">EventBuffer::unlock</a> — Releases lock acquired by EventBuffer::lock</li><li><a href="eventbuffer.write.php">EventBuffer::write</a> — Write contents of the buffer to a file or socket</li></ul>
</div>
<?php manual_footer($setup); ?>