if( byteBuffer == null )
{
// End of stream reached.
session.removeAttribute( CURRENT_STREAM );
WriteFuture writeFuture = ( WriteFuture ) session.removeAttribute( INITIAL_WRITE_FUTURE );
// Write queued WriteRequests.
Queue queue = ( Queue ) session.removeAttribute( WRITE_REQUEST_QUEUE );
if( queue != null )
{
WriteRequest wr = ( WriteRequest ) queue.pop();
while( wr != null )
{
filterWrite( nextFilter, session, wr );
wr = ( WriteRequest ) queue.pop();
}
}
writeFuture.setWritten( true );
nextFilter.messageSent( session, inputStream );
}
else
{
nextFilter.filterWrite( session, new WriteRequest( byteBuffer ) );