Function ReadBuffer.opIndex

Returns a free chunk of the buffer.

T[] opIndex();

Add (+=) the number of the read bytes after using it.

Returns

A free chunk of the buffer.

Example

ReadBuffer!ubyte b;
size_t numberRead;
ubyte[] result;

// Fills the buffer with values 0..10
numberRead = fillBuffer(b[], 0, 10);
b += numberRead;

assert(b.length == 10);
result = b[0 .. $];
assert(result[0] == 0);
assert(result[9] == 9);
b.clear();
assert(b.length == 0);