Class Rev::Buffer
In: ext/rev/rev_buffer.c
Parent: Object

High speed buffering geared towards non-blocking I/O.

Data is stored in a byte queue implemented as a linked list of equal size chunks. Since every node in the list is the same size they are easily memory pooled. Routines are provided for high speed non-blocking reads and writes from Ruby IO objects.


<<   append   clear   empty?   new   prepend   read   read_from   size   to_str   write_to  

Public Class methods

Public Instance methods

Append the given data to the end of the buffer

Append the given data to the end of the buffer

Prepend the given data to the beginning of the buffer

Read the specified abount of data from the buffer. If no value is given the entire contents of the buffer are returned. Any data read from the buffer is cleared.

Perform a nonblocking read of the the given IO object and fill the buffer with any data received. The call will read as much data as it can until the read would block.

Return the size of the buffer in bytes

Convert the Buffer to a String. The original buffer is unmodified.

Perform a nonblocking write of the buffer to the given IO object. As much data as possible is written until the call would block. Any data which is written is removed from the buffer.