public final void add ( ByteBuf buf , ChannelFutureListener listener ) { // buffers are added before promises so that we naturally 'consume' the entire buffer during removal // before we complete it's promise. bufAndListenerPairs . add ( buf ) ; if ( listener != null ) { bufAndListenerPairs . add ( listener ) ; } incrementReadableBytes ( buf . readableBytes ( ) ) ; }
Add a buffer to the end of the queue and associate a listener with it that should be completed when all the buffers bytes have been consumed from the queue and written .