<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Read data from an evbuffer and drain the bytes read</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="eventbuffer.pullup.html">EventBuffer::pullup</a></div> <div class="next" style="text-align: right; float: right;"><a href="eventbuffer.readfrom.html">EventBuffer::readFrom</a></div> <div class="up"><a href="class.eventbuffer.html">EventBuffer</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="eventbuffer.read" class="refentry"> <div class="refnamediv"> <h1 class="refname">EventBuffer::read</h1> <p class="verinfo">(PECL event >= 1.6.0)</p><p class="refpurpose"><span class="refname">EventBuffer::read</span> — <span class="dc-title">Read data from an evbuffer and drain the bytes read</span></p> </div> <div class="refsect1 description" id="refsect1-eventbuffer.read-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><strong>EventBuffer::read</strong></span> ( <span class="methodparam"> <span class="type">int</span> <code class="parameter">$max_bytes</code> </span> )</div> <p class="para rdfs-comment"> Read the first <em><code class="parameter">max_bytes</code></em> from the buffer and drain the bytes read. If more <em><code class="parameter">max_bytes</code></em> are requested than are available in the buffer, it only extracts as many bytes as available. </p> </div> <div class="refsect1 parameters" id="refsect1-eventbuffer.read-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <span class="term"> <em><code class="parameter">max_bytes</code></em> </span> <dd> <p class="para"> Maxmimum number of bytes to read from the buffer. </p> </dd> </dt> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-eventbuffer.read-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns string read, or <strong><code>FALSE</code></strong> on failure. </p> </div> <div class="refsect1 changelog" id="refsect1-eventbuffer.read-changelog"> <h3 class="title">Changelog</h3> <p class="para"> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>1.6.0</td> <td> Renamed <span class="methodname"><strong>EventBuffer::read()</strong></span>(the old method name) to <span class="methodname"><strong>EventBuffer::read()</strong></span>. <span class="methodname"><strong>EventBuffer::read()</strong></span> now takes only <em><code class="parameter">max_bytes</code></em> argument; returns string instead of integer. </td> </tr> </tbody> </table> </p> </div> <div class="refsect1 seealso" id="refsect1-eventbuffer.read-seealso"> <h3 class="title">See Also</h3> <ul class="simplelist"> <li class="member"> <span class="methodname"><a href="eventbuffer.copyout.html" class="methodname" rel="rdfs-seeAlso">EventBuffer::copyout()</a> - Copies out specified number of bytes from the front of the buffer</span> </li> <li class="member"> <span class="methodname"><a href="eventbuffer.drain.html" class="methodname" rel="rdfs-seeAlso">EventBuffer::drain()</a> - Removes specified number of bytes from the front of the buffer without copying it anywhere</span> </li> <li class="member"> <span class="methodname"><a href="eventbuffer.pullup.html" class="methodname" rel="rdfs-seeAlso">EventBuffer::pullup()</a> - Linearizes data within buffer and returns it's contents as a string</span> </li> <li class="member"> <span class="methodname"><a href="eventbuffer.readline.html" class="methodname" rel="rdfs-seeAlso">EventBuffer::readLine()</a> - Extracts a line from the front of the buffer</span> </li> <li class="member"> <span class="methodname"><a href="eventbuffer.appendfrom.html" class="methodname" rel="rdfs-seeAlso">EventBuffer::appendFrom()</a> - Moves the specified number of bytes from a source buffer to the end of the current buffer</span> </li> </ul> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="eventbuffer.pullup.html">EventBuffer::pullup</a></div> <div class="next" style="text-align: right; float: right;"><a href="eventbuffer.readfrom.html">EventBuffer::readFrom</a></div> <div class="up"><a href="class.eventbuffer.html">EventBuffer</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>