<!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>The Swoole\Buffer class</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="swoole-atomic.sub.html">Swoole\Atomic::sub</a></div> <div class="next" style="text-align: right; float: right;"><a href="swoole-buffer.append.html">Swoole\Buffer::append</a></div> <div class="up"><a href="book.swoole.html">Swoole</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="class.swoole-buffer" class="reference"> <h1 class="title">The Swoole\Buffer class</h1> <div class="partintro"><p class="verinfo">(PHP 5 >= 5.2.0, PHP 7, PECL swoole >= 1.9.0)</p> <div class="section" id="swoole-buffer.intro"> <h2 class="title">Introduction</h2> <p class="para"> </p> </div> <div class="section" id="swoole-buffer.synopsis"> <h2 class="title">Class synopsis</h2> <div class="classsynopsis"> <div class="ooclass"></div> <div class="classsynopsisinfo"> <span class="ooclass"> <strong class="classname">Swoole\Buffer</strong> </span> {</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">integer</span> <span class="methodname"><a href="swoole-buffer.append.html" class="methodname">append</a></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="swoole-buffer.clear.html" class="methodname">clear</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="swoole-buffer.destruct.html" class="methodname">__destruct</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">integer</span> <span class="methodname"><a href="swoole-buffer.expand.html" class="methodname">expand</a></span> ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$size</code></span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><a href="swoole-buffer.read.html" class="methodname">read</a></span> ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$offset</code></span> , <span class="methodparam"><span class="type">integer</span> <code class="parameter">$length</code></span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="swoole-buffer.recycle.html" class="methodname">recycle</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><a href="swoole-buffer.substr.html" class="methodname">substr</a></span> ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$offset</code></span> [, <span class="methodparam"><span class="type">integer</span> <code class="parameter">$length</code></span> [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$remove</code></span> ]] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><a href="swoole-buffer.tostring.html" class="methodname">__toString</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="swoole-buffer.write.html" class="methodname">write</a></span> ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$offset</code></span> , <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span> )</div> }</div> </div> </div> <h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="swoole-buffer.append.html">Swoole\Buffer::append</a> — Append the string or binary data at the end of the memory buffer and return the new size of memory allocated.</li><li><a href="swoole-buffer.clear.html">Swoole\Buffer::clear</a> — Reset the memory buffer.</li><li><a href="swoole-buffer.construct.html">Swoole\Buffer::__construct</a> — Fixed size memory blocks allocation.</li><li><a href="swoole-buffer.destruct.html">Swoole\Buffer::__destruct</a> — Destruct the Swoole memory buffer.</li><li><a href="swoole-buffer.expand.html">Swoole\Buffer::expand</a> — Expand the size of memory buffer.</li><li><a href="swoole-buffer.read.html">Swoole\Buffer::read</a> — Read data from the memory buffer based on offset and length.</li><li><a href="swoole-buffer.recycle.html">Swoole\Buffer::recycle</a> — Release the memory to OS which is not used by the memory buffer.</li><li><a href="swoole-buffer.substr.html">Swoole\Buffer::substr</a> — Read data from the memory buffer based on offset and length. Or remove data from the memory buffer.</li><li><a href="swoole-buffer.tostring.html">Swoole\Buffer::__toString</a> — Get the string value of the memory buffer.</li><li><a href="swoole-buffer.write.html">Swoole\Buffer::write</a> — Write data to the memory buffer. The memory allocated for the buffer will not be changed.</li></ul> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="swoole-atomic.sub.html">Swoole\Atomic::sub</a></div> <div class="next" style="text-align: right; float: right;"><a href="swoole-buffer.append.html">Swoole\Buffer::append</a></div> <div class="up"><a href="book.swoole.html">Swoole</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>