No cache version.
Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.
The EventBuffer class
(PECL event >= 1.5.0)
Introduction
EventBuffer represents Libevent's "evbuffer", an utility functionality for buffered I/O.
Event buffers are meant to be generally useful for doing the "buffer" part of buffered network I/O.
Class synopsis
Properties
- length
-
The number of bytes stored in an event buffer.
- contiguous_space
-
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.
Predefined Constants
-
EventBuffer::EOL_ANY
-
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.
-
EventBuffer::EOL_CRLF
-
The end of the line is an optional carriage return, followed by a linefeed. (In other words, it is either a "\r\n" or a "\n" .) This format is useful in parsing text-based Internet protocols, since the standards generally prescribe a "\r\n" line-terminator, but nonconformant clients sometimes say just "\n" .
-
EventBuffer::EOL_CRLF_STRICT
-
The end of a line is a single carriage return, followed by a single linefeed. (This is also known as "\r\n" . The ASCII values are
0x0D
0x0A
). -
EventBuffer::EOL_LF
-
The end of a line is a single linefeed character. (This is also known as "\n" . It is ASCII value is
0x0A
.) -
EventBuffer::PTR_SET
-
Flag used as argument of EventBuffer::setPosition() method. If this flag specified, the position pointer is moved to an absolute position within the buffer.
-
EventBuffer::PTR_ADD
-
The same as
EventBuffer::PTR_SET
, except this flag causes EventBuffer::setPosition() method to move position forward up to the specified number of bytes(instead of setting absolute position).
Table of Contents
- EventBuffer::add — Append data to the end of an event buffer
- EventBuffer::addBuffer — Move all data from a buffer provided to the current instance of EventBuffer
- EventBuffer::appendFrom — Moves the specified number of bytes from a source buffer to the end of the current buffer
- EventBuffer::__construct — Constructs EventBuffer object
- EventBuffer::copyout — Copies out specified number of bytes from the front of the buffer
- EventBuffer::drain — Removes specified number of bytes from the front of the buffer without copying it anywhere
- EventBuffer::enableLocking — Description
- EventBuffer::expand — Reserves space in buffer
- EventBuffer::freeze — Prevent calls that modify an event buffer from succeeding
- EventBuffer::lock — Acquires a lock on buffer
- EventBuffer::prepend — Prepend data to the front of the buffer
- EventBuffer::prependBuffer — Moves all data from source buffer to the front of current buffer
- EventBuffer::pullup — Linearizes data within buffer and returns it's contents as a string
- EventBuffer::read — Read data from an evbuffer and drain the bytes read
- EventBuffer::readFrom — Read data from a file onto the end of the buffer
- EventBuffer::readLine — Extracts a line from the front of the buffer
- EventBuffer::search — Scans the buffer for an occurrence of a string
- EventBuffer::searchEol — Scans the buffer for an occurrence of an end of line
- EventBuffer::substr — Substracts a portion of the buffer data
- EventBuffer::unfreeze — Re-enable calls that modify an event buffer
- EventBuffer::unlock — Releases lock acquired by EventBuffer::lock
- EventBuffer::write — Write contents of the buffer to a file or socket
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-class.eventbuffer.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.