EventBuffer
class EventBuffer (View source)
EventBuffer.
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.
Constants
EOL_ANY |
|
EOL_CRLF |
|
EOL_CRLF_STRICT |
|
EOL_LF |
|
EOL_NUL |
|
PTR_SET |
|
PTR_ADD |
|
Properties
int | $length | ||
int | $contiguous_space |
Methods
__construct.
add.
copyout.
drain.
enableLocking.
expand.
freeze.
lock.
prepend.
pullup.
read.
readFrom.
readLine.
search.
searchEol.
substr.
unfreeze.
unlock.
write.
Details
__construct()
__construct.
Constructs EventBuffer object.
bool
add(string $data)
add.
Append data to the end of an event buffer.
bool
addBuffer(EventBuffer $buf)
addBuffer.
Move all data from a buffer provided to the current instance of EventBuffer.
int
appendFrom(EventBuffer $buf, int $len)
appendFrom.
Moves the specified number of bytes from a source buffer to the end of the current buffer.
int
copyout(string $data, int $max_bytes)
copyout.
Copies out specified number of bytes from the front of the buffer.
bool
drain(int $len)
drain.
Removes specified number of bytes from the front of the buffer without copying it anywhere.
void
enableLocking()
enableLocking.
bool
expand(int $len)
expand.
Reserves space in buffer.
bool
freeze(bool $at_front)
freeze.
Prevent calls that modify an event buffer from succeeding.
void
lock()
lock.
Acquires a lock on buffer.
bool
prepend(string $data)
prepend.
Prepend data to the front of the buffer.
bool
prependBuffer(EventBuffer $buf)
prependBuffer.
Moves all data from source buffer to the front of current buffer.
string|null
pullup(int $size)
pullup.
Linearizes data within buffer and returns it's contents as a string.
string|null
read(int $max_bytes)
read.
Read data from an evbuffer and drain the bytes read.
int
readFrom(mixed $fd, int $howmuch)
readFrom.
Read data from a file onto the end of the buffer.
string|null
readLine(int $eol_style)
readLine.
Extracts a line from the front of the buffer.
int|false
search(string $what, int $start = 1, int $end = 1)
search.
Scans the buffer for an occurrence of a string.
int|false
searchEol(int $start = 1, int $eol_style = EventBuffer::EOL_ANY)
searchEol.
Scans the buffer for an occurrence of an end of line.
string
substr(int $start, int $length)
substr.
Substracts a portion of the buffer data.
bool
unfreeze(bool $at_front)
unfreeze.
Re-enable calls that modify an event buffer.
void
unlock()
unlock.
Releases lock acquired by EventBuffer::lock.
int|false
write(mixed $fd, int $howmuch)
write.
Write contents of the buffer to a file or socket.