Class ReadBuffer

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

class ReadBuffer
  : Buffer ;

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 ReadBuffer.clear() before you append the result of the pended asynchronous call.

Constructors

NameDescription
this (size, minAvailable) Creates a new read buffer.

Fields

NameTypeDescription
blockSize immutable(ulong)Size by which the buffer will grow.
buffer_ ubyte[]Internal buffer.
length_ ulongFilled buffer length.
minAvailable immutable(ulong)Available space.
ring ulongLast position returned with [].
start ulongStart of available data.

Properties

NameTypeDescription
capacity[get] ulong
free[get] ulong
length[get] ulong
opDollar[get] ulong
opSlice[set] ubyte[]
opIndex[get] ubyte[]
opSlice[set] ubyte[]

Methods

NameDescription
clear () Clears the buffer.
opIndex () Returns a free chunk of the buffer.
opOpAssign (length) Appends some data to the buffer.