Number of the bytes read.
$(D_KEYWORD this).
auto b = defaultAllocator.make!ReadBuffer; size_t numberRead; ubyte[] result; // Fills the buffer with values 0..10 numberRead = fillBuffer(b[], b.free, 0, 10); b += numberRead; result = b[0..$]; assert(result[0] == 0); assert(result[1] == 1); assert(result[9] == 9); b.clear(); // It shouldn't overwrite, but append another 5 bytes to the buffer numberRead = fillBuffer(b[], b.free, 0, 10); b += numberRead; numberRead = fillBuffer(b[], b.free, 20, 25); b += numberRead; result = b[0..$]; assert(result[0] == 0); assert(result[1] == 1); assert(result[9] == 9); assert(result[10] == 20); assert(result[14] == 24); defaultAllocator.dispose(b);
Appends some data to the buffer.