<!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>Copies out specified number of bytes from the front of the buffer</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="eventbuffer.construct.html">EventBuffer::__construct</a></div> <div class="next" style="text-align: right; float: right;"><a href="eventbuffer.drain.html">EventBuffer::drain</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.copyout" class="refentry"> <div class="refnamediv"> <h1 class="refname">EventBuffer::copyout</h1> <p class="verinfo">(PECL event >= 1.2.6-beta)</p><p class="refpurpose"><span class="refname">EventBuffer::copyout</span> — <span class="dc-title">Copies out specified number of bytes from the front of the buffer</span></p> </div> <div class="refsect1 description" id="refsect1-eventbuffer.copyout-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><strong>EventBuffer::copyout</strong></span> ( <span class="methodparam"> <span class="type">string</span> <code class="parameter reference">&$data</code> </span> , <span class="methodparam"> <span class="type">int</span> <code class="parameter">$max_bytes</code> </span> )</div> <p class="para rdfs-comment"> Behaves just like <span class="methodname"><a href="eventbuffer.read.html" class="methodname">EventBuffer::read()</a></span> , but does not drain any data from the buffer. I.e. it copies the first <em><code class="parameter">max_bytes</code></em> bytes from the front of the buffer into <em><code class="parameter">data</code></em> . If there are fewer than <em><code class="parameter">max_bytes</code></em> bytes available, the function copies all the bytes there are. </p> </div> <div class="refsect1 parameters" id="refsect1-eventbuffer.copyout-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <span class="term"> <em><code class="parameter">data</code></em> </span> <dd> <p class="para"> Output string. </p> </dd> </dt> <dt> <span class="term"> <em><code class="parameter">max_bytes</code></em> </span> <dd> <p class="para"> The number of bytes to copy. </p> </dd> </dt> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-eventbuffer.copyout-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns the number of bytes copied, or <strong><code>-1</code></strong> on failure. </p> </div> <div class="refsect1 seealso" id="refsect1-eventbuffer.copyout-seealso"> <h3 class="title">See Also</h3> <ul class="simplelist"> <li class="member"> <span class="methodname"><a href="eventbuffer.read.html" class="methodname" rel="rdfs-seeAlso">EventBuffer::read()</a> - Read data from an evbuffer and drain the bytes read</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.construct.html">EventBuffer::__construct</a></div> <div class="next" style="text-align: right; float: right;"><a href="eventbuffer.drain.html">EventBuffer::drain</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>