Refactor buffered writer

 * Properly cleanup reading flag in processChain;
 * Make a clearer distinction between chunks and chain;
 * Fix Doxygen markup;

Problem: no count is kept of data dropped in the buffers.

fixes: #1529
refs: #1471, #1545

Signed-off-by: Olivier Mehani <olivier.mehani@nicta.com.au>