ReadBuffer

Self-expanding buffer, that can be used with functions returning the number of the read bytes.

This buffer supports asynchronous reading. It means you can pass a new chunk to an asynchronous read function during you are working with already available data. But only one asynchronous call at a time is supported. Be sure to call $(D_PSYMBOL ReadBuffer.clear()) before you append the result of the pended asynchronous call.

Constructors

this
this(size_t size, size_t minAvailable)

Creates a new read buffer.

Destructor

~this
~this()

Deallocates the internal buffer.

Members

Functions

clear
ReadBuffer clear()

Clears the buffer.

opIndex
ubyte[] opIndex()

Returns a free chunk of the buffer.

opOpAssign
ReadBuffer opOpAssign(size_t length)

Appends some data to the buffer.

Properties

capacity
size_t capacity [@property getter]
free
size_t free [@property getter]
length
size_t length [@property getter]
opDollar
size_t opDollar [@property getter]
opSlice
ubyte[] opSlice(size_t start, size_t end)

Variables

blockSize
size_t blockSize;

Size by which the buffer will grow.

buffer_
ubyte[] buffer_;

Internal buffer.

length_
size_t length_;

Filled buffer length.

minAvailable
size_t minAvailable;

Available space.

ring
size_t ring;

Last position returned with $(D_KEYWORD []).

start
size_t start;

Start of available data.

Inherited Members

From Buffer

capacity
size_t capacity [@property getter]
length
size_t length [@property getter]
free
size_t free [@property getter]
opSlice
ubyte[] opSlice(size_t start, size_t end)
opDollar
size_t opDollar [@property getter]
opIndex
ubyte[] opIndex [@property getter]

Meta